about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-11-04 16:55:08 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-11-05 10:50:47 -0700
commite126f3c6c699d7ca58a1be94bb9af4292a83436d (patch)
treeb984f31d18305076c65cf3201732cb4cc7752678 /src/test
parent0eff43ff7584d416e6de5d3ade2da1ab17730331 (diff)
parent50ecee241008a17a3d296f0a0d2a4ff9080a5c57 (diff)
Merge branch 'selfgate' of https://github.com/petrochenkov/rust into rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/struct-path-associated-type.rs2
-rw-r--r--src/test/compile-fail/struct-path-self-feature-gate.rs29
-rw-r--r--src/test/compile-fail/struct-path-self-type-mismatch.rs2
-rw-r--r--src/test/compile-fail/struct-path-self.rs2
-rw-r--r--src/test/run-pass/struct-path-associated-type.rs2
-rw-r--r--src/test/run-pass/struct-path-self.rs2
6 files changed, 39 insertions, 0 deletions
diff --git a/src/test/compile-fail/struct-path-associated-type.rs b/src/test/compile-fail/struct-path-associated-type.rs
index 660ac44ce0b..ecaf269fcb1 100644
--- a/src/test/compile-fail/struct-path-associated-type.rs
+++ b/src/test/compile-fail/struct-path-associated-type.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(more_struct_aliases)]
+
 struct S;
 
 trait Tr {
diff --git a/src/test/compile-fail/struct-path-self-feature-gate.rs b/src/test/compile-fail/struct-path-self-feature-gate.rs
new file mode 100644
index 00000000000..a2050182a7e
--- /dev/null
+++ b/src/test/compile-fail/struct-path-self-feature-gate.rs
@@ -0,0 +1,29 @@
+// Copyright 2016 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.
+
+struct S;
+
+trait Tr {
+    type A;
+}
+
+fn f<T: Tr<A = S>>() {
+    let _ = T::A {};
+    //~^ ERROR `Self` and associated types in struct expressions and patterns are unstable
+}
+
+impl S {
+    fn f() {
+        let _ = Self {};
+        //~^ ERROR `Self` and associated types in struct expressions and patterns are unstable
+    }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/struct-path-self-type-mismatch.rs b/src/test/compile-fail/struct-path-self-type-mismatch.rs
index f694e7d277c..8352bd6751f 100644
--- a/src/test/compile-fail/struct-path-self-type-mismatch.rs
+++ b/src/test/compile-fail/struct-path-self-type-mismatch.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(more_struct_aliases)]
+
 struct Foo<A> { inner: A }
 
 trait Bar { fn bar(); }
diff --git a/src/test/compile-fail/struct-path-self.rs b/src/test/compile-fail/struct-path-self.rs
index 067d6ac22dc..aeac199227b 100644
--- a/src/test/compile-fail/struct-path-self.rs
+++ b/src/test/compile-fail/struct-path-self.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(more_struct_aliases)]
+
 struct S;
 
 trait Tr {
diff --git a/src/test/run-pass/struct-path-associated-type.rs b/src/test/run-pass/struct-path-associated-type.rs
index b033ed5c802..292761dfd00 100644
--- a/src/test/run-pass/struct-path-associated-type.rs
+++ b/src/test/run-pass/struct-path-associated-type.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(more_struct_aliases)]
+
 struct S<T, U = u16> {
     a: T,
     b: U,
diff --git a/src/test/run-pass/struct-path-self.rs b/src/test/run-pass/struct-path-self.rs
index c7a282c2a2f..b569ab62c1b 100644
--- a/src/test/run-pass/struct-path-self.rs
+++ b/src/test/run-pass/struct-path-self.rs
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+#![feature(more_struct_aliases)]
+
 use std::ops::Add;
 
 struct S<T, U = u16> {