about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/lib.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-03-15 21:06:40 +0100
committerRalf Jung <post@ralfj.de>2024-03-20 11:07:12 +0100
commit712fe36611cf18306d3912beb5456cb0a7d0d276 (patch)
tree882100f5e503dba761eb72d31529c7ecb95324c6 /compiler/rustc_mir_transform/src/lib.rs
parentd31b6fb8c06b43536ac5be38462d2a55784e2199 (diff)
downloadrust-712fe36611cf18306d3912beb5456cb0a7d0d276.tar.gz
rust-712fe36611cf18306d3912beb5456cb0a7d0d276.zip
collector: recursively traverse 'mentioned' items to evaluate their constants
Diffstat (limited to 'compiler/rustc_mir_transform/src/lib.rs')
-rw-r--r--compiler/rustc_mir_transform/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs
index afe228be127..74e7d51ea96 100644
--- a/compiler/rustc_mir_transform/src/lib.rs
+++ b/compiler/rustc_mir_transform/src/lib.rs
@@ -89,6 +89,7 @@ mod lint;
 mod lower_intrinsics;
 mod lower_slice_len;
 mod match_branches;
+mod mentioned_items;
 mod multiple_return_terminators;
 mod normalize_array_len;
 mod nrvo;
@@ -566,6 +567,10 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
         tcx,
         body,
         &[
+            // Before doing anything, remember which items are being mentioned so that the set of items
+            // visited does not depend on the optimization level.
+            &mentioned_items::MentionedItems,
+            // Add some UB checks before any UB gets optimized away.
             &check_alignment::CheckAlignment,
             // Before inlining: trim down MIR with passes to reduce inlining work.