-
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.
Add a MIR pre-codegen test for Vec::deref
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// skip-filecheck | ||
//@ compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2 | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
|
||
#![crate_type = "lib"] | ||
|
||
// Added after it stopped inlining in a nightly; see | ||
// <https://github.com/rust-lang/rust/issues/123174> | ||
|
||
// EMIT_MIR vec_deref.vec_deref_to_slice.PreCodegen.after.mir | ||
pub fn vec_deref_to_slice(v: &Vec<u8>) -> &[u8] { | ||
v | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.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 `vec_deref_to_slice` after PreCodegen | ||
|
||
fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { | ||
debug v => _1; | ||
let mut _0: &[u8]; | ||
|
||
bb0: { | ||
_0 = <Vec<u8> as Deref>::deref(move _1) -> [return: bb1, unwind unreachable]; | ||
} | ||
|
||
bb1: { | ||
return; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.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 `vec_deref_to_slice` after PreCodegen | ||
|
||
fn vec_deref_to_slice(_1: &Vec<u8>) -> &[u8] { | ||
debug v => _1; | ||
let mut _0: &[u8]; | ||
|
||
bb0: { | ||
_0 = <Vec<u8> as Deref>::deref(move _1) -> [return: bb1, unwind continue]; | ||
} | ||
|
||
bb1: { | ||
return; | ||
} | ||
} |