about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-03-11 12:55:45 +0100
committerGitHub <noreply@github.com>2023-03-11 12:55:45 +0100
commite12ba7300ae8936fe5627b43719a8b9df7e9a730 (patch)
tree05a239fccc142440bfe32b0bff8309da9ef9dc69 /compiler/rustc_resolve/src
parent8b679551047da1f50574c8e377e46e5c511ee321 (diff)
parentc84c5e6439199d58ac62a144590c335b182c12d1 (diff)
downloadrust-e12ba7300ae8936fe5627b43719a8b9df7e9a730.tar.gz
rust-e12ba7300ae8936fe5627b43719a8b9df7e9a730.zip
Rollup merge of #108988 - adrianheine:crate-reference-block, r=petrochenkov
rustdoc: Don't crash on `crate` references in blocks

This is a regression from #94857.
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/lib.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index 5eba208e3ed..f6888e55ad4 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -1849,20 +1849,12 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
         &mut self,
         path_str: &str,
         ns: Namespace,
-        mut parent_scope: ParentScope<'a>,
+        parent_scope: ParentScope<'a>,
     ) -> Option<Res> {
         let mut segments =
             Vec::from_iter(path_str.split("::").map(Ident::from_str).map(Segment::from_ident));
         if let Some(segment) = segments.first_mut() {
-            if segment.ident.name == kw::Crate {
-                // FIXME: `resolve_path` always resolves `crate` to the current crate root, but
-                // rustdoc wants it to resolve to the `parent_scope`'s crate root. This trick of
-                // replacing `crate` with `self` and changing the current module should achieve
-                // the same effect.
-                segment.ident.name = kw::SelfLower;
-                parent_scope.module =
-                    self.expect_module(parent_scope.module.def_id().krate.as_def_id());
-            } else if segment.ident.name == kw::Empty {
+            if segment.ident.name == kw::Empty {
                 segment.ident.name = kw::PathRoot;
             }
         }