|
1 |
| -error: expected identifier, found keyword `Self` |
| 1 | +error: unexpected keyword `Self` in generic parameters |
2 | 2 | --> $DIR/keyword-self-as-type-param.rs:3:12
|
3 | 3 | |
|
4 | 4 | LL | struct Foo<Self>(Self);
|
5 |
| - | ^^^^ expected identifier, found keyword |
| 5 | + | ^^^^ |
| 6 | + | |
| 7 | + = note: you cannot use `Self` as a generic parameter because it is reserved for associated items |
6 | 8 |
|
7 |
| -error: expected identifier, found keyword `Self` |
| 9 | +error: unexpected keyword `Self` in generic parameters |
8 | 10 | --> $DIR/keyword-self-as-type-param.rs:7:11
|
9 | 11 | |
|
10 | 12 | LL | trait Bar<Self> {}
|
11 |
| - | ^^^^ expected identifier, found keyword |
| 13 | + | ^^^^ |
| 14 | + | |
| 15 | + = note: you cannot use `Self` as a generic parameter because it is reserved for associated items |
12 | 16 |
|
13 |
| -error[E0392]: parameter `Self` is never used |
14 |
| - --> $DIR/keyword-self-as-type-param.rs:3:12 |
| 17 | +error[E0072]: recursive type `Foo` has infinite size |
| 18 | + --> $DIR/keyword-self-as-type-param.rs:3:1 |
15 | 19 | |
|
16 | 20 | LL | struct Foo<Self>(Self);
|
17 |
| - | ^^^^ unused parameter |
| 21 | + | ^^^^^^^^^^^^^^^^^----^^ |
| 22 | + | | | |
| 23 | + | | recursive without indirection |
| 24 | + | recursive type has infinite size |
| 25 | + | |
| 26 | +help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable |
18 | 27 | |
|
19 |
| - = help: consider removing `Self`, referring to it in a field, or using a marker such as `PhantomData` |
20 |
| - = help: if you intended `Self` to be a const parameter, use `const Self: usize` instead |
| 28 | +LL | struct Foo<Self>(Box<Self>); |
| 29 | + | ++++ + |
21 | 30 |
|
22 | 31 | error: aborting due to 3 previous errors
|
23 | 32 |
|
24 |
| -For more information about this error, try `rustc --explain E0392`. |
| 33 | +For more information about this error, try `rustc --explain E0072`. |
0 commit comments