about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-06-23 12:38:27 +0000
committerbors <bors@rust-lang.org>2025-06-23 12:38:27 +0000
commit42245d34d22ade32b3f276dcf74deb826841594c (patch)
tree8b813764cf5705a92cf4be577b8ec223d1875b61 /compiler/rustc_middle/src
parentae2fc9722f08ef131407c1dc8057768868f65e8e (diff)
parent3e8e06545e8152c98f0d5ec75a6116b8070d9f8e (diff)
downloadrust-42245d34d22ade32b3f276dcf74deb826841594c.tar.gz
rust-42245d34d22ade32b3f276dcf74deb826841594c.zip
Auto merge of #142906 - jdonszelmann:rollup-togt1dl, r=jdonszelmann
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#142493 (rework `#[naked]` attribute parser)
 - rust-lang/rust#142636 (bootstrap.example.toml: use less contextual format)
 - rust-lang/rust#142822 (Make `PartialEq` a `const_trait`)
 - rust-lang/rust#142892 (Fix ICE on debug builds where lints are delayed on the crate root)
 - rust-lang/rust#142904 (notify me when rdg is touched)

Failed merges:

 - rust-lang/rust#142827 (Move error code explanation removal check into tidy)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/hir/map.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs
index 03bb97095a4..291707878a3 100644
--- a/compiler/rustc_middle/src/hir/map.rs
+++ b/compiler/rustc_middle/src/hir/map.rs
@@ -1254,10 +1254,18 @@ pub(crate) fn hir_crate_items(tcx: TyCtxt<'_>, _: ()) -> ModuleItems {
         body_owners,
         opaques,
         nested_bodies,
-        delayed_lint_items,
+        mut delayed_lint_items,
         ..
     } = collector;
 
+    // The crate could have delayed lints too, but would not be picked up by the visitor.
+    // The `delayed_lint_items` list is smart - it only contains items which we know from
+    // earlier passes is guaranteed to contain lints. It's a little harder to determine that
+    // for sure here, so we simply always add the crate to the list. If it has no lints,
+    // we'll discover that later. The cost of this should be low, there's only one crate
+    // after all compared to the many items we have we wouldn't want to iterate over later.
+    delayed_lint_items.push(CRATE_OWNER_ID);
+
     ModuleItems {
         add_root: true,
         submodules: submodules.into_boxed_slice(),