Rollup merge of #90649 - cjgillot:reveal-all-2, r=lcnr

Run reveal_all on MIR when inlining is activated.

Fix logic error in https://github.com/rust-lang/rust/pull/85254 which prevented the pass from running when needed.
Fixes https://github.com/rust-lang/rust/issues/78442
r? ``@lcnr``
This commit is contained in:
Matthias Krüger 2021-11-06 23:12:06 +01:00 committed by GitHub
commit ec471de865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -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());

View File

@ -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
@ -7,3 +7,5 @@ pub fn f<T>(a: &T) -> *const T {
fn main() {
f(&2);
}
// EMIT_MIR issue_78192.f.InstCombine.diff