-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #70259 - wesleywiser:use_reveal_all, r=eddyb
Use Reveal::All in MIR optimizations Resolves some code review feedback in #67662. Fixes #68855 r? @eddyb
- Loading branch information
Showing
3 changed files
with
68 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/test/mir-opt/const_prop/control-flow-simplification.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// compile-flags: -Zmir-opt-level=1 | ||
|
||
trait NeedsDrop:Sized{ | ||
const NEEDS:bool=std::mem::needs_drop::<Self>(); | ||
} | ||
|
||
impl<This> NeedsDrop for This{} | ||
|
||
fn hello<T>(){ | ||
if <bool>::NEEDS { | ||
panic!() | ||
} | ||
} | ||
|
||
pub fn main() { | ||
hello::<()>(); | ||
hello::<Vec<()>>(); | ||
} | ||
|
||
// END RUST SOURCE | ||
// START rustc.hello.ConstProp.before.mir | ||
// let mut _0: (); | ||
// let mut _1: bool; | ||
// let mut _2: !; | ||
// bb0: { | ||
// StorageLive(_1); | ||
// _1 = const <bool as NeedsDrop>::NEEDS; | ||
// switchInt(_1) -> [false: bb1, otherwise: bb2]; | ||
// } | ||
// bb1: { | ||
// _0 = (); | ||
// StorageDead(_1); | ||
// return; | ||
// } | ||
// bb2: { | ||
// StorageLive(_2); | ||
// const std::rt::begin_panic::<&str>(const "explicit panic"); | ||
// } | ||
// END rustc.hello.ConstProp.before.mir | ||
// START rustc.hello.ConstProp.after.mir | ||
// let mut _0: (); | ||
// let mut _1: bool; | ||
// let mut _2: !; | ||
// bb0: { | ||
// StorageLive(_1); | ||
// _1 = const false; | ||
// switchInt(const false) -> [false: bb1, otherwise: bb2]; | ||
// } | ||
// bb1: { | ||
// _0 = (); | ||
// StorageDead(_1); | ||
// return; | ||
// } | ||
// bb2: { | ||
// StorageLive(_2); | ||
// const std::rt::begin_panic::<&str>(const "explicit panic"); | ||
// } | ||
// END rustc.hello.ConstProp.after.mir | ||
// START rustc.hello.PreCodegen.before.mir | ||
// let mut _0: (); | ||
// bb0: { | ||
// return; | ||
// } | ||
// END rustc.hello.PreCodegen.before.mir |