From 961b688167039534f73c29b367cdaf7d6e8a1339 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 30 Aug 2021 20:59:45 +1200 Subject: [PATCH 1/4] test: add missing source for #4943 --- tests/source/issue_4943.rs | 9 +++++++++ tests/target/issue_4943.rs | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 tests/source/issue_4943.rs diff --git a/tests/source/issue_4943.rs b/tests/source/issue_4943.rs new file mode 100644 index 00000000000..0793b7b4fe1 --- /dev/null +++ b/tests/source/issue_4943.rs @@ -0,0 +1,9 @@ +#![feature(generic_associated_types)] + +impl SomeStruct { + fn process(v: T) -> ::R + where Self: GAT = T> + { + SomeStruct::do_something(v) + } +} diff --git a/tests/target/issue_4943.rs b/tests/target/issue_4943.rs index bc8f1a366da..318f7ebed6e 100644 --- a/tests/target/issue_4943.rs +++ b/tests/target/issue_4943.rs @@ -1,3 +1,5 @@ +#![feature(generic_associated_types)] + impl SomeStruct { fn process(v: T) -> ::R where From d4104e77b0089ba8fbd46552f0fbc9b9ed4b5f27 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 30 Aug 2021 21:09:21 +1200 Subject: [PATCH 2/4] test: add test for #4257 --- tests/source/issue_4257.rs | 13 +++++++++++++ tests/target/issue_4257.rs | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 tests/source/issue_4257.rs create mode 100644 tests/target/issue_4257.rs diff --git a/tests/source/issue_4257.rs b/tests/source/issue_4257.rs new file mode 100644 index 00000000000..2b887fadb62 --- /dev/null +++ b/tests/source/issue_4257.rs @@ -0,0 +1,13 @@ +#![feature(generic_associated_types)] +#![allow(incomplete_features)] + +trait Trait { + type Type<'a> where T: 'a; + fn foo(x: &T) -> Self::Type<'_>; +} +impl Trait for () { + type Type<'a> where T: 'a = &'a T; + fn foo(x: &T) -> Self::Type<'_> { + x + } +} diff --git a/tests/target/issue_4257.rs b/tests/target/issue_4257.rs new file mode 100644 index 00000000000..1ebaaf2b600 --- /dev/null +++ b/tests/target/issue_4257.rs @@ -0,0 +1,18 @@ +#![feature(generic_associated_types)] +#![allow(incomplete_features)] + +trait Trait { + type Type<'a> + where + T: 'a; + fn foo(x: &T) -> Self::Type<'_>; +} +impl Trait for () { + type Type<'a> + where + T: 'a, + = &'a T; + fn foo(x: &T) -> Self::Type<'_> { + x + } +} From 564da372b962c8a65e8024ac9ee52f44f3d41564 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 30 Aug 2021 21:13:42 +1200 Subject: [PATCH 3/4] test: add test for #4954 --- tests/source/issue_4954.rs | 5 +++++ tests/target/issue_4954.rs | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/source/issue_4954.rs create mode 100644 tests/target/issue_4954.rs diff --git a/tests/source/issue_4954.rs b/tests/source/issue_4954.rs new file mode 100644 index 00000000000..8011c601b65 --- /dev/null +++ b/tests/source/issue_4954.rs @@ -0,0 +1,5 @@ +trait Foo { + type Arg<'a>; +} + +struct Bar(T) where for<'a> T: Foo = ()>; diff --git a/tests/target/issue_4954.rs b/tests/target/issue_4954.rs new file mode 100644 index 00000000000..aa5e79befe9 --- /dev/null +++ b/tests/target/issue_4954.rs @@ -0,0 +1,7 @@ +trait Foo { + type Arg<'a>; +} + +struct Bar(T) +where + for<'a> T: Foo = ()>; From dcd8bb7ccbfedf913bafdd4197e6525e5c4a6a85 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 30 Aug 2021 21:17:43 +1200 Subject: [PATCH 4/4] test: add test for #4322 --- tests/source/issue_4322.rs | 3 +++ tests/target/issue_4322.rs | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 tests/source/issue_4322.rs create mode 100644 tests/target/issue_4322.rs diff --git a/tests/source/issue_4322.rs b/tests/source/issue_4322.rs new file mode 100644 index 00000000000..b28cc7cdd12 --- /dev/null +++ b/tests/source/issue_4322.rs @@ -0,0 +1,3 @@ +trait Bar { + type X<'a> where Self: 'a; +} diff --git a/tests/target/issue_4322.rs b/tests/target/issue_4322.rs new file mode 100644 index 00000000000..0ec0547119f --- /dev/null +++ b/tests/target/issue_4322.rs @@ -0,0 +1,5 @@ +trait Bar { + type X<'a> + where + Self: 'a; +}