forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
#[rustc_no_mir_inline]
for standard library UB checks
Co-authored-by: Ben Kimock <kimockb@gmail.com>
- Loading branch information
Showing
9 changed files
with
107 additions
and
3 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
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
19 changes: 19 additions & 0 deletions
19
tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-abort.diff
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,19 @@ | ||
- // MIR for `caller` before Inline | ||
+ // MIR for `caller` after Inline | ||
|
||
fn caller() -> () { | ||
let mut _0: (); | ||
let _1: (); | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = callee() -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_1); | ||
_0 = const (); | ||
return; | ||
} | ||
} | ||
|
19 changes: 19 additions & 0 deletions
19
tests/mir-opt/inline/rustc_no_mir_inline.caller.Inline.panic-unwind.diff
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,19 @@ | ||
- // MIR for `caller` before Inline | ||
+ // MIR for `caller` after Inline | ||
|
||
fn caller() -> () { | ||
let mut _0: (); | ||
let _1: (); | ||
|
||
bb0: { | ||
StorageLive(_1); | ||
_1 = callee() -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
StorageDead(_1); | ||
_0 = const (); | ||
return; | ||
} | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-abort.mir
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,14 @@ | ||
// MIR for `caller` after PreCodegen | ||
|
||
fn caller() -> () { | ||
let mut _0: (); | ||
let _1: (); | ||
|
||
bb0: { | ||
_1 = callee() -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
return; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/inline/rustc_no_mir_inline.caller.PreCodegen.after.panic-unwind.mir
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,14 @@ | ||
// MIR for `caller` after PreCodegen | ||
|
||
fn caller() -> () { | ||
let mut _0: (); | ||
let _1: (); | ||
|
||
bb0: { | ||
_1 = callee() -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
return; | ||
} | ||
} |
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,17 @@ | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
#![crate_type = "lib"] | ||
#![feature(rustc_attrs)] | ||
|
||
//@ compile-flags: -Zmir-opt-level=2 -Zinline-mir | ||
|
||
#[inline] | ||
#[rustc_no_mir_inline] | ||
pub fn callee() {} | ||
|
||
// EMIT_MIR rustc_no_mir_inline.caller.Inline.diff | ||
// EMIT_MIR rustc_no_mir_inline.caller.PreCodegen.after.mir | ||
pub fn caller() { | ||
// CHECK-LABEL: fn caller( | ||
// CHECK: callee() | ||
callee(); | ||
} |