forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#62417 - alexreg:fix-self-in-type-alias, r=p…
…nkfelix Fix ICEs when `Self` is used in type aliases I think it is right just to disallow this at resolution stage rather than let typeck produce a cyclic error. This is in line with previous behaviour. There was probably no need at all for the change that introduced this bug in rust-lang#57428, so I've simply reversed it. Fixes rust-lang#62263, rust-lang#62364, rust-lang#62305. r? @eddyb
- Loading branch information
Showing
11 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub trait Trait { | ||
type A; | ||
} | ||
|
||
pub type Alias = dyn Trait<A = Self::A>; | ||
//~^ ERROR failed to resolve: use of undeclared type or module `Self` [E0433] | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0433]: failed to resolve: use of undeclared type or module `Self` | ||
--> $DIR/issue-62263-self-in-atb.rs:5:32 | ||
| | ||
LL | pub type Alias = dyn Trait<A = Self::A>; | ||
| ^^^^ use of undeclared type or module `Self` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0433`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type Alias = Self::Target; | ||
//~^ ERROR failed to resolve: use of undeclared type or module `Self` [E0433] | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0433]: failed to resolve: use of undeclared type or module `Self` | ||
--> $DIR/issue-62305-self-assoc-ty.rs:1:14 | ||
| | ||
LL | type Alias = Self::Target; | ||
| ^^^^ use of undeclared type or module `Self` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0433`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
struct Struct<P1> { | ||
field: P1, | ||
} | ||
|
||
type Alias<'a> = Struct<&'a Self>; | ||
//~^ ERROR cannot find type `Self` in this scope [E0411] | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0411]: cannot find type `Self` in this scope | ||
--> $DIR/issue-62364-self-ty-arg.rs:5:29 | ||
| | ||
LL | type Alias<'a> = Struct<&'a Self>; | ||
| ^^^^ `Self` is only available in impls, traits, and type definitions | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0411`. |