Add a MIR pre-codegen test for Vec::deref
This commit is contained in:
parent
5800dc1faa
commit
b76faff1b2
13
tests/mir-opt/pre-codegen/vec_deref.rs
Normal file
13
tests/mir-opt/pre-codegen/vec_deref.rs
Normal file
@ -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
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user