]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/shadowing.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / shadowing.rs
1 #![feature(generic_associated_types)]
2
3 trait Shadow<'a> {
4     type Bar<'a>;
5     //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope
6 }
7
8 trait NoShadow<'a> {
9     type Bar<'b>; // OK
10 }
11
12 impl<'a> NoShadow<'a> for &'a u32 {
13     type Bar<'a> = i32;
14     //~^ ERROR lifetime name `'a` shadows a lifetime name that is already in scope
15 }
16
17 trait ShadowT<T> {
18     type Bar<T>;
19     //~^ ERROR the name `T` is already used
20 }
21
22 trait NoShadowT<T> {
23     type Bar<U>; // OK
24 }
25
26 impl<T> NoShadowT<T> for Option<T> {
27     type Bar<T> = i32;
28     //~^ ERROR the name `T` is already used
29 }
30
31 fn main() {}