about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-11-05 16:44:48 +1300
committerNick Cameron <ncameron@mozilla.com>2014-11-18 10:02:27 +1300
commitd46f7adb536a44975622890e166c7cdfc698c259 (patch)
tree4ba641ab7c36573a914990bc297881276d5dd9a8
parent85914df05a95b1d14e483b69d9c4f0eba44b5d25 (diff)
downloadrust-d46f7adb536a44975622890e166c7cdfc698c259.tar.gz
rust-d46f7adb536a44975622890e166c7cdfc698c259.zip
Regression test
-rw-r--r--src/test/compile-fail/coercion-slice.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/compile-fail/coercion-slice.rs b/src/test/compile-fail/coercion-slice.rs
new file mode 100644
index 00000000000..bb020688f58
--- /dev/null
+++ b/src/test/compile-fail/coercion-slice.rs
@@ -0,0 +1,15 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that we forbid coercion from `[T, ..n]` to `&[T]`
+
+fn main() {
+    let _: &[int] = [0i]; //~ERROR: mismatched types: expected `&[int]`, found `[int, ..1]`
+}