forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve worsened debug build codegen
- Loading branch information
1 parent
38114ff
commit 4f40511
Showing
2 changed files
with
65 additions
and
8 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
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 |