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`
This commit is contained in:
Dylan DPC
2022-04-12 23:16:56 +02:00
committed by GitHub
8 changed files with 2337 additions and 2191 deletions

View File

@@ -1271,12 +1271,11 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
// Look for associated items in the current trait.
if let Some((module, _)) = self.current_trait_ref {
if let Ok(binding) = self.r.resolve_ident_in_module(
if let Ok(binding) = self.r.maybe_resolve_ident_in_module(
ModuleOrUniformRoot::Module(module),
ident,
ns,
&self.parent_scope,
None,
) {
let res = binding.res();
if filter_fn(res) {