Don't suggest macros that out of scope

This commit is contained in:
Temirkhan Myrzamadi 2020-08-29 01:01:29 +06:00
parent 479298e05e
commit ea7cf61068
4 changed files with 9 additions and 15 deletions

View file

@ -929,8 +929,15 @@ 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);
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) {