about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-03-05 20:55:29 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-03-05 20:55:29 +0000
commit5d7234abb65fa8cf0007ed03dfd8448eb9128f5d (patch)
tree6a552f4a18963288d1aa9d37bd4ccc0d4218f563
parent0fbfc3e76916521b509b63286296dd0762170d34 (diff)
downloadrust-5d7234abb65fa8cf0007ed03dfd8448eb9128f5d.tar.gz
rust-5d7234abb65fa8cf0007ed03dfd8448eb9128f5d.zip
Add test.
-rw-r--r--tests/ui/mir/unsize-trait.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/mir/unsize-trait.rs b/tests/ui/mir/unsize-trait.rs
new file mode 100644
index 00000000000..45b5308c093
--- /dev/null
+++ b/tests/ui/mir/unsize-trait.rs
@@ -0,0 +1,15 @@
+// Check that the interpreter does not ICE when trying to unsize `B` to `[u8]`.
+// This is a `build` test to ensure that const-prop-lint runs.
+// build-pass
+
+#![feature(unsize)]
+
+fn foo<B>(buffer: &mut [B; 2])
+    where B: std::marker::Unsize<[u8]>,
+{
+    let buffer: &[u8] = &buffer[0];
+}
+
+fn main() {
+    foo(&mut [[0], [5]]);
+}