summaryrefslogtreecommitdiffstats
path: root/src/test/ui/coercion/coercion-slice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/coercion/coercion-slice.rs')
-rw-r--r--src/test/ui/coercion/coercion-slice.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/ui/coercion/coercion-slice.rs b/src/test/ui/coercion/coercion-slice.rs
new file mode 100644
index 000000000..b756c8f82
--- /dev/null
+++ b/src/test/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]`
+}