Skip to content

Commit fe499a7

Browse files
committed
Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
resolve: Improve candidate search for unresolved macro suggestions Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names. The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around). This should be the last pre-requisite for #62086. r? @davidtwco
2 parents a336998 + 1b4fbfc commit fe499a7

File tree

66 files changed

+1170
-1271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1170
-1271
lines changed

src/librustc/hir/def.rs

+8
Original file line numberDiff line numberDiff line change
@@ -398,4 +398,12 @@ impl<Id> Res<Id> {
398398
Res::Err => Res::Err,
399399
}
400400
}
401+
402+
pub fn macro_kind(self) -> Option<MacroKind> {
403+
match self {
404+
Res::Def(DefKind::Macro(kind), _) => Some(kind),
405+
Res::NonMacroAttr(..) => Some(MacroKind::Attr),
406+
_ => None,
407+
}
408+
}
401409
}

src/librustc_resolve/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
//! Here we build the "reduced graph": the graph of the module tree without
44
//! any imports resolved.
55
6-
use crate::macros::{InvocationData, ParentScope, LegacyScope};
6+
use crate::macros::{InvocationData, LegacyScope};
77
use crate::resolve_imports::ImportDirective;
88
use crate::resolve_imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport};
99
use crate::{Module, ModuleData, ModuleKind, NameBinding, NameBindingKind, Segment, ToNameBinding};
10-
use crate::{ModuleOrUniformRoot, PerNS, Resolver, ResolverArenas, ExternPreludeEntry};
10+
use crate::{ModuleOrUniformRoot, ParentScope, PerNS, Resolver, ResolverArenas, ExternPreludeEntry};
1111
use crate::Namespace::{self, TypeNS, ValueNS, MacroNS};
1212
use crate::{resolve_error, resolve_struct_error, ResolutionError, Determinacy};
1313

0 commit comments

Comments
 (0)