diff options
Diffstat (limited to 'compiler/rustc_resolve/src/macros.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/macros.rs | 13 | 
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 3637854f120..d0ffef798cf 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -168,7 +168,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { hygiene::update_dollar_crate_names(|ctxt| { let ident = Ident::new(kw::DollarCrate, DUMMY_SP.with_ctxt(ctxt)); match self.resolve_crate_root(ident).kind { - ModuleKind::Def(.., name) if name != kw::Empty => name, + ModuleKind::Def(.., name) if let Some(name) = name => name, _ => kw::Crate, } }); @@ -264,7 +264,7 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> { } InvocationKind::Bang { ref mac, .. } => (&mac.path, MacroKind::Bang), InvocationKind::Derive { ref path, .. } => (path, MacroKind::Derive), - InvocationKind::GlobDelegation { ref item } => { + InvocationKind::GlobDelegation { ref item, .. } => { let ast::AssocItemKind::DelegationMac(deleg) = &item.kind else { unreachable!() }; deleg_impl = Some(self.invocation_parent(invoc_id)); // It is sufficient to consider glob delegation a bang macro for now. @@ -1067,11 +1067,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { ); if fallback_binding.ok().and_then(|b| b.res().opt_def_id()) != Some(def_id) { let location = match parent_scope.module.kind { - ModuleKind::Def(_, _, name) if name == kw::Empty => { - "the crate root".to_string() - } ModuleKind::Def(kind, def_id, name) => { - format!("{} `{name}`", kind.descr(def_id)) + if let Some(name) = name { + format!("{} `{name}`", kind.descr(def_id)) + } else { + "the crate root".to_string() + } } ModuleKind::Block => "this scope".to_string(), };  | 
