about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2015-12-30 15:25:31 -0800
committerAaron Turon <aturon@mozilla.com>2016-03-14 15:04:38 -0700
commited8d059d8d49491b736ea88edd8f2b57a866c44a (patch)
tree4191f763d9dbe11ba6fd4c2483f042b4c087d787 /src/test/compile-fail
parente81691039854e678381042ce93e13bee6971c3d9 (diff)
downloadrust-ed8d059d8d49491b736ea88edd8f2b57a866c44a.tar.gz
rust-ed8d059d8d49491b736ea88edd8f2b57a866c44a.zip
Adjust tests for feature gate, and add tests for the gate itself
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/specialization-default-projection.rs2
-rw-r--r--src/test/compile-fail/specialization-default-types.rs2
-rw-r--r--src/test/compile-fail/specialization-feature-gate-default.rs19
-rw-r--r--src/test/compile-fail/specialization-feature-gate-overlap.rs23
-rw-r--r--src/test/compile-fail/specialization-negative-impl.rs1
-rw-r--r--src/test/compile-fail/specialization-no-default.rs2
-rw-r--r--src/test/compile-fail/specialization-overlap-negative.rs1
-rw-r--r--src/test/compile-fail/specialization-overlap.rs2
8 files changed, 52 insertions, 0 deletions
diff --git a/src/test/compile-fail/specialization-default-projection.rs b/src/test/compile-fail/specialization-default-projection.rs
index b85dba126e6..3f85a503f62 100644
--- a/src/test/compile-fail/specialization-default-projection.rs
+++ b/src/test/compile-fail/specialization-default-projection.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(specialization)]
+
 // Make sure we can't project defaulted associated types
 
 trait Foo {
diff --git a/src/test/compile-fail/specialization-default-types.rs b/src/test/compile-fail/specialization-default-types.rs
index f6b2dd46efc..dce1db06a92 100644
--- a/src/test/compile-fail/specialization-default-types.rs
+++ b/src/test/compile-fail/specialization-default-types.rs
@@ -12,6 +12,8 @@
 // associated type in the impl defining it -- otherwise, what happens
 // if it's overridden?
 
+#![feature(specialization)]
+
 trait Example {
     type Output;
     fn generate(self) -> Self::Output;
diff --git a/src/test/compile-fail/specialization-feature-gate-default.rs b/src/test/compile-fail/specialization-feature-gate-default.rs
new file mode 100644
index 00000000000..caac21278d4
--- /dev/null
+++ b/src/test/compile-fail/specialization-feature-gate-default.rs
@@ -0,0 +1,19 @@
+// Copyright 2015 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.
+
+trait Foo {
+    fn foo(&self);
+}
+
+impl<T> Foo for T {
+    default fn foo(&self) {} //~ ERROR
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/specialization-feature-gate-overlap.rs b/src/test/compile-fail/specialization-feature-gate-overlap.rs
new file mode 100644
index 00000000000..a7918e4426d
--- /dev/null
+++ b/src/test/compile-fail/specialization-feature-gate-overlap.rs
@@ -0,0 +1,23 @@
+// Copyright 2015 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.
+
+trait Foo {
+    fn foo(&self);
+}
+
+impl<T> Foo for T {
+    fn foo(&self) {}
+}
+
+impl Foo for u8 { //~ ERROR
+    fn foo(&self) {}
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/specialization-negative-impl.rs b/src/test/compile-fail/specialization-negative-impl.rs
index d0d698d12e0..3a907dc3b8e 100644
--- a/src/test/compile-fail/specialization-negative-impl.rs
+++ b/src/test/compile-fail/specialization-negative-impl.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(optin_builtin_traits)]
+#![feature(specialization)]
 
 struct TestType<T>(T);
 
diff --git a/src/test/compile-fail/specialization-no-default.rs b/src/test/compile-fail/specialization-no-default.rs
index 3e23c6e06ea..143c6f0e858 100644
--- a/src/test/compile-fail/specialization-no-default.rs
+++ b/src/test/compile-fail/specialization-no-default.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(specialization)]
+
 trait Foo {
     fn foo(&self);
     fn bar(&self);
diff --git a/src/test/compile-fail/specialization-overlap-negative.rs b/src/test/compile-fail/specialization-overlap-negative.rs
index cc427b4fed2..62a6d8d9b50 100644
--- a/src/test/compile-fail/specialization-overlap-negative.rs
+++ b/src/test/compile-fail/specialization-overlap-negative.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(optin_builtin_traits)]
+#![feature(specialization)]
 
 trait MyTrait {}
 
diff --git a/src/test/compile-fail/specialization-overlap.rs b/src/test/compile-fail/specialization-overlap.rs
index 7d14e85fba8..57529d2ae42 100644
--- a/src/test/compile-fail/specialization-overlap.rs
+++ b/src/test/compile-fail/specialization-overlap.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(specialization)]
+
 trait Foo {}
 impl<T: Clone> Foo for T {}
 impl<T> Foo for Vec<T> {} //~ ERROR E0119