about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2024-10-03 17:42:08 -0700
committerMichael Howell <michael@notriddle.com>2024-10-03 22:01:23 -0700
commit253fec494fa336ee27c6cb027ffdb3d6e0b632c3 (patch)
treefaffaa3f4bc88db84d31ce789e4b3c977ada7670 /compiler
parent9ff5fc4ffbbe1e911527aa054e789b05ae55ffcc (diff)
downloadrust-253fec494fa336ee27c6cb027ffdb3d6e0b632c3.tar.gz
rust-253fec494fa336ee27c6cb027ffdb3d6e0b632c3.zip
rustdoc: prevent ctors from resolving
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_resolve/src/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index fcbbb523cfc..24a0c252e55 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -2148,7 +2148,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
 
         match self.maybe_resolve_path(&segments, Some(ns), &parent_scope, None) {
             PathResult::Module(ModuleOrUniformRoot::Module(module)) => Some(module.res().unwrap()),
-            PathResult::NonModule(path_res) => path_res.full_res(),
+            PathResult::NonModule(path_res) => {
+                path_res.full_res().filter(|res| !matches!(res, Res::Def(DefKind::Ctor(..), _)))
+            }
             PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => {
                 None
             }