diff --git a/tests/mir-opt/pre-codegen/vec_deref.rs b/tests/mir-opt/pre-codegen/vec_deref.rs new file mode 100644 index 0000000000000..3476e1760c0a8 --- /dev/null +++ b/tests/mir-opt/pre-codegen/vec_deref.rs @@ -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 +// + +// EMIT_MIR vec_deref.vec_deref_to_slice.PreCodegen.after.mir +pub fn vec_deref_to_slice(v: &Vec) -> &[u8] { + v +} diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir new file mode 100644 index 0000000000000..df8d5c3836f1c --- /dev/null +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-abort.mir @@ -0,0 +1,14 @@ +// MIR for `vec_deref_to_slice` after PreCodegen + +fn vec_deref_to_slice(_1: &Vec) -> &[u8] { + debug v => _1; + let mut _0: &[u8]; + + bb0: { + _0 = as Deref>::deref(move _1) -> [return: bb1, unwind unreachable]; + } + + bb1: { + return; + } +} diff --git a/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir new file mode 100644 index 0000000000000..d26afef4653ec --- /dev/null +++ b/tests/mir-opt/pre-codegen/vec_deref.vec_deref_to_slice.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,14 @@ +// MIR for `vec_deref_to_slice` after PreCodegen + +fn vec_deref_to_slice(_1: &Vec) -> &[u8] { + debug v => _1; + let mut _0: &[u8]; + + bb0: { + _0 = as Deref>::deref(move _1) -> [return: bb1, unwind continue]; + } + + bb1: { + return; + } +}