diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-12-09 07:25:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-09 07:25:47 +0100 |
| commit | 04dac4285aefc2fb18ad07b1e40f6771e0763aea (patch) | |
| tree | 796b1b354041013db7a9123f620a3f115f5882b3 /compiler/rustc_const_eval/src | |
| parent | 6111a7345be5f50b7170aa6ec69a5d823878cb27 (diff) | |
| parent | e73ef59cb6d806d9f5405237383d65bf02095127 (diff) | |
| download | rust-04dac4285aefc2fb18ad07b1e40f6771e0763aea.tar.gz rust-04dac4285aefc2fb18ad07b1e40f6771e0763aea.zip | |
Rollup merge of #105455 - lcnr:correct-reveal-in-validate, r=jackh726
use the correct `Reveal` during validation supersedes #105454. Deals with https://github.com/rust-lang/rust/issues/105009#issuecomment-1342395333, not closing #105009 as the ICE may leak into beta The issue was the following: - we optimize the mir, using `Reveal::All` - some optimization relies on the hidden type of an opaque type - we then validate using `Reveal::UserFacing` again which is not able to observe the hidden type r? `@jackh726`
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index bf700d31224..5c9263dc5e3 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -2,6 +2,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_index::bit_set::BitSet; +use rustc_infer::traits::Reveal; use rustc_middle::mir::interpret::Scalar; use rustc_middle::mir::visit::NonUseContext::VarDebugInfo; use rustc_middle::mir::visit::{PlaceContext, Visitor}; @@ -44,8 +45,11 @@ impl<'tcx> MirPass<'tcx> for Validator { return; } let def_id = body.source.def_id(); - let param_env = tcx.param_env(def_id); let mir_phase = self.mir_phase; + let param_env = match mir_phase.reveal() { + Reveal::UserFacing => tcx.param_env(def_id), + Reveal::All => tcx.param_env_reveal_all_normalized(def_id), + }; let always_live_locals = always_storage_live_locals(body); let storage_liveness = MaybeStorageLive::new(always_live_locals) |
