Rollup merge of #91908 - matthiaskrgr:ices, r=jackh726

Add 2 tests

fixes #91139
fixes #91069
This commit is contained in:
Matthias Krüger 2022-02-12 09:26:20 +01:00 committed by GitHub
commit 661be4c782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// check-pass
pub trait Associate {
type Associated;
}
pub struct Wrap<'a> {
pub field: &'a i32,
}
pub trait Create<T> {
fn create() -> Self;
}
pub fn oh_no<'a, T>()
where
Wrap<'a>: Associate,
<Wrap<'a> as Associate>::Associated: Create<T>,
{
<Wrap<'a> as Associate>::Associated::create();
}
pub fn main() {}

View File

@ -0,0 +1,22 @@
// check-pass
#![feature(generic_associated_types)]
trait Foo<T> {
type Type<'a>
where
T: 'a;
}
impl<T> Foo<T> for () {
type Type<'a>
where
T: 'a,
= ();
}
fn foo<T>() {
let _: for<'a> fn(<() as Foo<T>>::Type<'a>, &'a T) = |_, _| ();
}
pub fn main() {}