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_middle/src/mir | |
| 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_middle/src/mir')
| -rw-r--r-- | compiler/rustc_middle/src/mir/syntax.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 614e0d012b3..5ba053820e0 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -6,6 +6,7 @@ use super::{BasicBlock, Constant, Field, Local, SwitchTargets, UserTypeProjection}; use crate::mir::coverage::{CodeRegion, CoverageKind}; +use crate::traits::Reveal; use crate::ty::adjustment::PointerCast; use crate::ty::subst::SubstsRef; use crate::ty::{self, List, Ty}; @@ -100,6 +101,13 @@ impl MirPhase { MirPhase::Runtime(RuntimePhase::Optimized) => "runtime-optimized", } } + + pub fn reveal(&self) -> Reveal { + match *self { + MirPhase::Built | MirPhase::Analysis(_) => Reveal::UserFacing, + MirPhase::Runtime(_) => Reveal::All, + } + } } /// See [`MirPhase::Analysis`]. |
