From e565b5bbdd93b2b2bf9b5b7867320201c6a0cb81 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 14 Nov 2017 12:17:28 -0500 Subject: [PATCH] demonstrate how we can write "successful parse" tests quite easily --- .../parse/in-trait-impl.rs | 19 ++++++++++++++ .../parse/in-trait.rs | 25 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs create mode 100644 src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs 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 000000000000..bb4a285ec71e --- /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 or the MIT license +// , 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 Baz for T where T: Foo { + type Quux<'a> = ::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 000000000000..3c3f20b9ff60 --- /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 or the MIT license +// , 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() {}