Skip to content

Commit

Permalink
Suggest imports of unresolved macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirrolot committed Sep 30, 2020
1 parent 6ac6c67 commit 13dfbb6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_resolve/src/diagnostics.rs
Expand Up @@ -929,6 +929,10 @@ impl<'a> Resolver<'a> {
);
self.add_typo_suggestion(err, suggestion, ident.span);

let import_suggestions =
self.lookup_import_candidates(ident, Namespace::MacroNS, parent_scope, |_| true);
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);
Expand Down

0 comments on commit 13dfbb6

Please sign in to comment.