Skip to content

Commit

Permalink
Rollup merge of #90649 - cjgillot:reveal-all-2, r=lcnr
Browse files Browse the repository at this point in the history
Run reveal_all on MIR when inlining is activated.

Fix logic error in #85254 which prevented the pass from running when needed.
Fixes #78442
r? ``@lcnr``
  • Loading branch information
matthiaskrgr authored Nov 6, 2021
2 parents 43fee0e + a3776d9 commit ec471de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/reveal_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl<'tcx> MirPass<'tcx> for RevealAll {
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
// This pass must run before inlining, since we insert callee bodies in RevealAll mode.
// Do not apply this transformation to generators.
if (tcx.sess.mir_opt_level() >= 3 || !super::inline::is_enabled(tcx))
if (tcx.sess.mir_opt_level() >= 3 || super::inline::is_enabled(tcx))
&& body.generator.is_none()
{
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
Expand Down
4 changes: 3 additions & 1 deletion src/test/mir-opt/issue-78192.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// EMIT_MIR issue_78192.f.InstCombine.diff
// compile-flags: -Zmir-opt-level=1 -Zinline-mir
pub fn f<T>(a: &T) -> *const T {
let b: &*const T = &(a as *const T);
*b
Expand All @@ -7,3 +7,5 @@ pub fn f<T>(a: &T) -> *const T {
fn main() {
f(&2);
}

// EMIT_MIR issue_78192.f.InstCombine.diff

0 comments on commit ec471de

Please sign in to comment.