about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-06-23 14:39:07 -0700
committerGitHub <noreply@github.com>2022-06-23 14:39:07 -0700
commit3b68700d0ce297e48c6448f27d156d5f461d64e9 (patch)
tree3b0ad77acef4869134e68b7e9b28f59aac09944c /compiler/rustc_resolve/src
parent413e350f87fafeea3da13fc98337c632c4cfcd70 (diff)
parentf924e74fb1c238b0e6c06c23b51c087f1e6aa0d5 (diff)
downloadrust-3b68700d0ce297e48c6448f27d156d5f461d64e9.tar.gz
rust-3b68700d0ce297e48c6448f27d156d5f461d64e9.zip
Rollup merge of #98269 - compiler-errors:provide-more-segment-res, r=petrochenkov
Provide a `PathSegment.res` in more cases

I find that in many cases, the `res` associated with a `PathSegment` is `Res::Err` even though the path was fully resolved. A few diagnostics use this `res` and their error messages suffer because of the lack of resolved segment.

This fixes it a bit, but it's obviously not complete and I'm not exactly sure if it's correct.
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/ident.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs
index e934e189f05..0cc6d05d1d0 100644
--- a/compiler/rustc_resolve/src/ident.rs
+++ b/compiler/rustc_resolve/src/ident.rs
@@ -1502,6 +1502,7 @@ impl<'a> Resolver<'a> {
                         return PathResult::NonModule(PartialRes::new(Res::Err));
                     } else if opt_ns.is_some() && (is_last || maybe_assoc) {
                         self.lint_if_path_starts_with_module(finalize, path, second_binding);
+                        record_segment_res(self, res);
                         return PathResult::NonModule(PartialRes::with_unresolved_segments(
                             res,
                             path.len() - i - 1,