about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-11-14 12:17:28 -0500
committerSunjay Varma <varma.sunjay@gmail.com>2017-12-01 01:26:29 -0500
commite565b5bbdd93b2b2bf9b5b7867320201c6a0cb81 (patch)
tree3ef5c530b1dffc5b2e61381f46d62efbe3b68e67
parent1b196fa32465874c84aca6adf940f581c2fc0d24 (diff)
downloadrust-e565b5bbdd93b2b2bf9b5b7867320201c6a0cb81.tar.gz
rust-e565b5bbdd93b2b2bf9b5b7867320201c6a0cb81.zip
demonstrate how we can write "successful parse" tests quite easily
-rw-r--r--src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs19
-rw-r--r--src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs25
2 files changed, 44 insertions, 0 deletions
diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs
new file mode 100644
index 00000000000..bb4a285ec71
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs
@@ -0,0 +1,19 @@
+// Copyright 2012 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.
+
+// compile-flags: -Zparse-only
+
+#![feature(generic_associated_types)]
+
+impl<T> Baz for T where T: Foo {
+    type Quux<'a> = <T as Foo>::Bar<'a, 'static>;
+}
+
+fn main() {}
diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs
new file mode 100644
index 00000000000..3c3f20b9ff6
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs
@@ -0,0 +1,25 @@
+// Copyright 2012 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.
+
+// compile-flags: -Zparse-only
+
+#![feature(generic_associated_types)]
+
+trait Foo {
+    type Bar<'a>;
+    type Bar<'a, 'b>;
+    type Bar<'a, 'b,>;
+    type Bar<'a, 'b, T>;
+    type Bar<'a, 'b, T, U>;
+    type Bar<'a, 'b, T, U,>;
+    type Bar<'a, 'b, T: Debug, U,>;
+}
+
+fn main() {}