Rollup merge of #75209 - Hirrolot:suggest-macro-imports, r=estebank
Suggest imports of unresolved macros Closes https://github.com/rust-lang/rust/issues/75191.
This commit is contained in:
commit
7581bb7c02
6 changed files with 26 additions and 0 deletions
|
@ -922,6 +922,17 @@ impl<'a> Resolver<'a> {
|
|||
);
|
||||
self.add_typo_suggestion(err, suggestion, ident.span);
|
||||
|
||||
let import_suggestions = self.lookup_import_candidates(
|
||||
ident,
|
||||
Namespace::MacroNS,
|
||||
parent_scope,
|
||||
|res| match res {
|
||||
Res::Def(DefKind::Macro(MacroKind::Bang), _) => true,
|
||||
_ => false,
|
||||
},
|
||||
);
|
||||
show_candidates(err, None, &import_suggestions, false, true);
|
||||
|
||||
if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) {
|
||||
let msg = format!("unsafe traits like `{}` should be implemented explicitly", ident);
|
||||
err.span_note(ident.span, &msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue