Fix ICE on type alias in recursion

This commit is contained in:
clubby789 2023-02-17 16:19:13 +00:00
parent f4f5fc3e5c
commit 21bcd2ee9c
4 changed files with 28 additions and 2 deletions

View file

@ -0,0 +1,2 @@
pub struct W<T>(T);
pub type Wrapper<T> = W<T>;

View file

@ -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() {}

View file

@ -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`.