diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-04-08 22:51:27 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-04-12 19:52:34 +0200 |
| commit | 3ee6f6e28a8d843df28b29bb70dd3dbb2267e39c (patch) | |
| tree | 869b054e9add1c9ebedfb49b34267c55679a3ca9 /compiler/rustc_resolve/src | |
| parent | 55ca03c0ac840d6f4f30f61bc381b02ca095b899 (diff) | |
| download | rust-3ee6f6e28a8d843df28b29bb70dd3dbb2267e39c.tar.gz rust-3ee6f6e28a8d843df28b29bb70dd3dbb2267e39c.zip | |
Do not record Res when builing a suggestion.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/ident.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 776ad704732..2507bc30019 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1459,7 +1459,7 @@ impl<'a> Resolver<'a> { enum FindBindingResult<'a> { Binding(Result<&'a NameBinding<'a>, Determinacy>), - PathResult(PathResult<'a>), + Res(Res), } let find_binding_in_ns = |this: &mut Self, ns| { let binding = if let Some(module) = module { @@ -1498,10 +1498,7 @@ impl<'a> Resolver<'a> { Some(LexicalScopeBinding::Res(res)) if opt_ns == Some(TypeNS) || opt_ns == Some(ValueNS) => { - record_segment_res(this, res); - return FindBindingResult::PathResult(PathResult::NonModule( - PartialRes::with_unresolved_segments(res, path.len() - 1), - )); + return FindBindingResult::Res(res); } _ => Err(Determinacy::determined(finalize.is_some())), } @@ -1509,7 +1506,13 @@ impl<'a> Resolver<'a> { FindBindingResult::Binding(binding) }; let binding = match find_binding_in_ns(self, ns) { - FindBindingResult::PathResult(x) => return x, + FindBindingResult::Res(res) => { + record_segment_res(self, res); + return PathResult::NonModule(PartialRes::with_unresolved_segments( + res, + path.len() - 1, + )); + } FindBindingResult::Binding(binding) => binding, }; match binding { |
