From 9b17e2d14d35f1c4eaf76ab6ad89c8ffe17889e5 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 --- src/test/ui/associated-types/issue-91069.rs | 24 +++++++++++++++++++ .../generic-associated-types/issue-91139.rs | 22 +++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 src/test/ui/associated-types/issue-91069.rs create mode 100644 src/test/ui/generic-associated-types/issue-91139.rs diff --git a/src/test/ui/associated-types/issue-91069.rs b/src/test/ui/associated-types/issue-91069.rs new file mode 100644 index 0000000000000..109c2eed27a33 --- /dev/null +++ b/src/test/ui/associated-types/issue-91069.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 0000000000000..2b82d2946b3ba --- /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() {}