about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-06-11 16:17:26 +0200
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-06-19 09:52:35 +0200
commit104b108406ab01d4ed96fac87a405602dab91c87 (patch)
tree743799ec930b1d95570b4682c4bf3f45cca6f187 /src/test
parent13f35de19d586ae125ec2c99b51d3d4a9321ca3b (diff)
downloadrust-104b108406ab01d4ed96fac87a405602dab91c87.tar.gz
rust-104b108406ab01d4ed96fac87a405602dab91c87.zip
Add and update more tests
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr2
-rw-r--r--src/test/ui/consts/packed_pattern2.rs27
2 files changed, 28 insertions, 1 deletions
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
index efb175f445d..f695ce30f19 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
+++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
@@ -7,7 +7,7 @@ LL |         *MUH.x.get() = 99;
 thread 'rustc' panicked at 'assertion failed: `(left != right)`
   left: `Const`,
  right: `Const`: UnsafeCells are not allowed behind references in constants. This should have been prevented statically by const qualification. If this were allowed one would be able to change a constant at one use site and other use sites may arbitrarily decide to change, too.', src/librustc_mir/interpret/intern.rs:126:17
-note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
 
 error: internal compiler error: unexpected panic
 
diff --git a/src/test/ui/consts/packed_pattern2.rs b/src/test/ui/consts/packed_pattern2.rs
new file mode 100644
index 00000000000..174161fbd94
--- /dev/null
+++ b/src/test/ui/consts/packed_pattern2.rs
@@ -0,0 +1,27 @@
+// run-pass
+
+#[derive(PartialEq, Eq, Copy, Clone)]
+#[repr(packed)]
+struct Foo {
+    field: (u8, u16),
+}
+
+#[derive(PartialEq, Eq, Copy, Clone)]
+#[repr(align(2))]
+struct Bar {
+    a: Foo,
+}
+
+const FOO: Bar = Bar {
+    a: Foo {
+        field: (5, 6),
+    }
+};
+
+fn main() {
+    match FOO {
+        Bar { a: Foo { field: (5, 6) } } => {},
+        FOO => unreachable!(),
+        _ => unreachable!(),
+    }
+}