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#108168 - clubby789:recursive-type-alias, r=…
…compiler-errors Fix ICE on type alias in recursion Fixes rust-lang#108160
- Loading branch information
Showing
4 changed files
with
28 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub struct W<T>(T); | ||
pub type Wrapper<T> = W<T>; |
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 @@ | ||
// aux-build: alias.rs | ||
// regression test for 108160 | ||
|
||
extern crate alias; | ||
|
||
use alias::Wrapper; | ||
struct Rec(Wrapper<Rec>); //~ ERROR recursive type `Rec` has infinite | ||
|
||
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,14 @@ | ||
error[E0072]: recursive type `Rec` has infinite size | ||
--> $DIR/infinite-alias.rs:7:1 | ||
| | ||
LL | struct Rec(Wrapper<Rec>); | ||
| ^^^^^^^^^^ ------------ recursive without indirection | ||
| | ||
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | ||
| | ||
LL | struct Rec(Box<Wrapper<Rec>>); | ||
| ++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0072`. |