|
1 | 1 | use crate::{AmbiguityError, AmbiguityKind, AmbiguityErrorMisc, Determinacy}; |
2 | 2 | use crate::{CrateLint, Resolver, ResolutionError, Scope, ScopeSet, ParentScope, Weak}; |
3 | 3 | use crate::{Module, ModuleKind, NameBinding, NameBindingKind, PathResult, Segment, ToNameBinding}; |
4 | | -use crate::{is_known_tool, resolve_error}; |
| 4 | +use crate::{resolve_error, KNOWN_TOOLS}; |
5 | 5 | use crate::ModuleOrUniformRoot; |
6 | 6 | use crate::Namespace::*; |
7 | 7 | use crate::build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport}; |
@@ -57,10 +57,10 @@ impl<'a> InvocationData<'a> { |
57 | 57 | /// Not modularized, can shadow previous legacy bindings, etc. |
58 | 58 | #[derive(Debug)] |
59 | 59 | pub struct LegacyBinding<'a> { |
60 | | - binding: &'a NameBinding<'a>, |
| 60 | + crate binding: &'a NameBinding<'a>, |
61 | 61 | /// Legacy scope into which the `macro_rules` item was planted. |
62 | 62 | crate parent_legacy_scope: LegacyScope<'a>, |
63 | | - ident: Ident, |
| 63 | + crate ident: Ident, |
64 | 64 | } |
65 | 65 |
|
66 | 66 | /// The scope introduced by a `macro_rules!` macro. |
@@ -582,7 +582,7 @@ impl<'a> Resolver<'a> { |
582 | 582 | } |
583 | 583 | } |
584 | 584 | Scope::ToolPrelude => { |
585 | | - if use_prelude && is_known_tool(ident.name) { |
| 585 | + if use_prelude && KNOWN_TOOLS.contains(&ident.name) { |
586 | 586 | let binding = (Res::ToolMod, ty::Visibility::Public, |
587 | 587 | DUMMY_SP, Mark::root()).to_name_binding(this.arenas); |
588 | 588 | Ok((binding, Flags::PRELUDE)) |
@@ -805,7 +805,7 @@ impl<'a> Resolver<'a> { |
805 | 805 | let msg = |
806 | 806 | format!("cannot find {} `{}{}` in this scope", kind.descr(), ident, bang); |
807 | 807 | let mut err = self.session.struct_span_err(ident.span, &msg); |
808 | | - self.suggest_macro_name(ident.name, kind, &mut err, ident.span); |
| 808 | + self.unresolved_macro_suggestions(&mut err, kind, &parent_scope, ident); |
809 | 809 | err.emit(); |
810 | 810 | } |
811 | 811 | } |
|
0 commit comments