]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-26262.rs
Auto merge of #78066 - bugadani:wat, r=jonas-schievink
[rust.git] / src / test / ui / issues / issue-26262.rs
1 // Check that projections don't count as constraining type parameters.
2
3 struct S<T>(T);
4
5 trait Tr { type Assoc; fn test(); }
6
7 impl<T: Tr> S<T::Assoc> {
8 //~^ ERROR the type parameter `T` is not constrained
9     fn foo(self, _: T) {
10         T::test();
11     }
12 }
13
14 trait Trait1<T> { type Bar; }
15 trait Trait2<'x> { type Foo; }
16
17 impl<'a,T: Trait2<'a>> Trait1<<T as Trait2<'a>>::Foo> for T {
18 //~^ ERROR the lifetime parameter `'a` is not constrained
19     type Bar = &'a ();
20 }
21
22 fn main() {}