2022-02-06 16:43:51 +08:00
|
|
|
$ cargo run
|
|
|
|
Compiling cons-list v0.1.0 (file:///projects/cons-list)
|
|
|
|
error[E0072]: recursive type `List` has infinite size
|
|
|
|
--> src/main.rs:1:1
|
|
|
|
|
|
|
|
|
1 | enum List {
|
|
|
|
| ^^^^^^^^^ recursive type has infinite size
|
|
|
|
2 | Cons(i32, List),
|
|
|
|
| ---- recursive without indirection
|
|
|
|
|
|
|
|
|
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable
|
|
|
|
|
|
|
|
|
2 | Cons(i32, Box<List>),
|
|
|
|
| ++++ +
|
|
|
|
|
2023-01-16 17:34:52 +08:00
|
|
|
For more information about this error, try `rustc --explain E0072`.
|
|
|
|
error: could not compile `cons-list` due to previous error
|