From f58ef221db5118965c862753018893490bbe5d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Tue, 14 Dec 2021 13:14:25 +0100 Subject: [PATCH] Add 2 tests fixes #91139 fixes #91069 --- .../generic-associated-types/issue-81069.rs | 24 +++++++++++++++++++ .../generic-associated-types/issue-91139.rs | 22 +++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/test/ui/generic-associated-types/issue-81069.rs create mode 100644 src/test/ui/generic-associated-types/issue-91139.rs diff --git a/src/test/ui/generic-associated-types/issue-81069.rs b/src/test/ui/generic-associated-types/issue-81069.rs new file mode 100644 index 000000000000..109c2eed27a3 --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-81069.rs @@ -0,0 +1,24 @@ +// check-pass + +pub trait Associate { + type Associated; +} + +pub struct Wrap<'a> { + pub field: &'a i32, +} + +pub trait Create { + fn create() -> Self; +} + +pub fn oh_no<'a, T>() +where + Wrap<'a>: Associate, + as Associate>::Associated: Create, +{ + as Associate>::Associated::create(); +} + + +pub fn main() {} diff --git a/src/test/ui/generic-associated-types/issue-91139.rs b/src/test/ui/generic-associated-types/issue-91139.rs new file mode 100644 index 000000000000..2b82d2946b3b --- /dev/null +++ b/src/test/ui/generic-associated-types/issue-91139.rs @@ -0,0 +1,22 @@ +// check-pass + +#![feature(generic_associated_types)] + +trait Foo { + type Type<'a> + where + T: 'a; +} + +impl Foo for () { + type Type<'a> + where + T: 'a, + = (); +} + +fn foo() { + let _: for<'a> fn(<() as Foo>::Type<'a>, &'a T) = |_, _| (); +} + +pub fn main() {}