Skip to content

Commit 2743c13

Browse files
authored
Rollup merge of #95405 - cjgillot:probe, r=petrochenkov
Move name resolution logic to a dedicated file The code resolution logic from an Ident is scattered between several files. The first commits creates `rustc_resolve::probe` module to hold the different mutually recursive functions together. Just a move, no code change. The following commits attempt to make the logic a bit more readable. The two fields `last_import_segment` and `unusable_binding` are replaced by function parameters. In order to manage the fallout, `maybe_` variants of the function are added, dedicated to speculative resolution. r? `@petrochenkov`
2 parents 0ec00c0 + 276b946 commit 2743c13

File tree

8 files changed

+2337
-2191
lines changed

8 files changed

+2337
-2191
lines changed

compiler/rustc_resolve/src/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
297297
Some(TypeNS),
298298
parent_scope,
299299
if finalize { Finalize::SimplePath(id, path.span) } else { Finalize::No },
300+
None,
300301
) {
301302
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
302303
let res = module.res().expect("visibility resolved to unnamed block");
@@ -1124,12 +1125,11 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
11241125
});
11251126
} else {
11261127
for ident in single_imports.iter().cloned() {
1127-
let result = self.r.resolve_ident_in_module(
1128+
let result = self.r.maybe_resolve_ident_in_module(
11281129
ModuleOrUniformRoot::Module(module),
11291130
ident,
11301131
MacroNS,
11311132
&self.parent_scope,
1132-
None,
11331133
);
11341134
if let Ok(binding) = result {
11351135
let import = macro_use_import(self, ident.span);

0 commit comments

Comments
 (0)