-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Description
struct Foo<T> {
x: Foo<[T; 1]>,
y: T,
}
struct Bar {
x: Foo<Bar>,
}
has the following output:
error[E0072]: recursive type `Foo` has infinite size
--> src/lib.rs:1:1
|
1 | struct Foo<T> {
| ^^^^^^^^^^^^^ recursive type has infinite size
2 | x: Foo<[T; 1]>,
| ----------- recursive without indirection
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
2 | x: Box<Foo<[T; 1]>>,
| ^^^^ ^
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
the stack overflow should not happen ^^
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.