From 264c149c8945b714a2922d412dde07b7651a5ea1 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Thu, 11 Apr 2019 11:11:11 +0200 Subject: [PATCH] Add test showing how byte slices are printed in MIR --- src/test/mir-opt/byte_slice.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/test/mir-opt/byte_slice.rs diff --git a/src/test/mir-opt/byte_slice.rs b/src/test/mir-opt/byte_slice.rs new file mode 100644 index 00000000000..ae5d7c4895f --- /dev/null +++ b/src/test/mir-opt/byte_slice.rs @@ -0,0 +1,15 @@ +// compile-flags: -Z mir-opt-level=0 + +fn main() { + let x = b"foo"; + let y = [5u8, b'x']; +} + +// END RUST SOURCE +// START rustc.main.EraseRegions.after.mir +// ... +// _1 = const Scalar(Ptr(Pointer { alloc_id: AllocId(0), offset: Size { raw: 0 }, tag: () })) : &[u8; 3]; +// ... +// _2 = [const 5u8, const 120u8]; +// ... +// END rustc.main.EraseRegions.after.mir