summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-16 21:37:51 +0000
committerbors <bors@rust-lang.org>2023-04-16 21:37:51 +0000
commit84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc (patch)
tree45864520870b60ee1bb662685becc5f0b4804744 /compiler/rustc_mir_transform/src
parentf18236dcd3d8191c91aca0c4ef43e1e27b6bc0dc (diff)
parentc2c413f56eca868a5b5335ba21efa08368735d01 (diff)
downloadrust-1.69.0.tar.gz
rust-1.69.0.zip
Auto merge of #110413 - pietroalbini:pa-1.69.0-stable, r=pietroalbini 1.69.0
[stable] Prepare Rust 1.69.0

Last minute backports:

*  #109643
* #110135
* #109938
* #109937
* #109266

This PR also bumps the channel to stable, and backports the release notes from master.

r? `@ghost`
cc `@rust-lang/release`
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/const_prop_lint.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs
index 6c1980ff3ad..fd9475748ce 100644
--- a/compiler/rustc_mir_transform/src/const_prop_lint.rs
+++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs
@@ -298,7 +298,15 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
             return None;
         }
 
-        self.use_ecx(source_info, |this| this.ecx.eval_mir_constant(&c.literal, Some(c.span), None))
+        // Normalization needed b/c const prop lint runs in
+        // `mir_drops_elaborated_and_const_checked`, which happens before
+        // optimized MIR. Only after optimizing the MIR can we guarantee
+        // that the `RevealAll` pass has happened and that the body's consts
+        // are normalized, so any call to resolve before that needs to be
+        // manually normalized.
+        let val = self.tcx.try_normalize_erasing_regions(self.param_env, c.literal).ok()?;
+
+        self.use_ecx(source_info, |this| this.ecx.eval_mir_constant(&val, Some(c.span), None))
     }
 
     /// Returns the value, if any, of evaluating `place`.