about summary refs log tree commit diff
path: root/tests/ui/coercion/coercion-slice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/coercion/coercion-slice.rs')
-rw-r--r--tests/ui/coercion/coercion-slice.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/ui/coercion/coercion-slice.rs b/tests/ui/coercion/coercion-slice.rs
new file mode 100644
index 00000000000..b756c8f8203
--- /dev/null
+++ b/tests/ui/coercion/coercion-slice.rs
@@ -0,0 +1,7 @@
+// Tests that we forbid coercion from `[T; n]` to `&[T]`
+
+fn main() {
+    let _: &[i32] = [0];
+    //~^ ERROR mismatched types
+    //~| expected `&[i32]`, found array `[{integer}; 1]`
+}