mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Add back Res::matches_ns, implemented in terms of ns
This commit is contained in:
@@ -1145,7 +1145,7 @@ fn lower_generic_arg(
|
||||
if let TyKind::Path(ref qself, ref path) = ty.kind {
|
||||
if let Some(partial_res) = self.resolver.get_partial_res(ty.id) {
|
||||
let res = partial_res.base_res();
|
||||
if res.ns().map(|ns| ns != Namespace::TypeNS).unwrap_or(false) {
|
||||
if !res.matches_ns(Namespace::TypeNS) {
|
||||
debug!(
|
||||
"lower_generic_arg: Lowering type argument as const argument: {:?}",
|
||||
ty,
|
||||
|
||||
@@ -461,4 +461,9 @@ pub fn ns(&self) -> Option<Namespace> {
|
||||
Res::Err => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Always returns `true` if `self` is `Res::Err`
|
||||
pub fn matches_ns(&self, ns: Namespace) -> bool {
|
||||
self.ns().map(|actual_ns| actual_ns == ns).unwrap_or(true)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user