复制 error[E0072]:recursive type`Node`has infinite size-->src/data_structures/linkedlist.rs:127:1|127|struct Node<T>{|^^^128|data:Rc<T>,129|prev:Node<T>,|---recursive without indirection 编译器错误消息为我们提供了如何继续操作的提示。我们正在被推动使用间接,这是谈论指针的另一种方式。 为...
Elem(i32,List),}>cargobuilderror[E0072]:recursivetype`first::List`hasinfinitesize-->src/first.rs:4:1|4|pubenumList{|^^^recursivetypehasinfinitesize5|Empty,6|Elem(i32,List),|---recursivewithoutindirection|=help:insertindirection(e.g.,a`Box`,`Rc`,or`&`)atsomepoint...
--> src/first.rs:1:1 | 1 | pub enum List { | ^^^ recursive type has infinite size 2 | Empty, 3 | Elem(i32, List), | --- recursive without indirection help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable | 3 | Elem(i32, Box<Li...
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 indirection (e.g., a `Box`, `Rc`, or `&`) at some point to...
报错如下: $ cargo run Compiling cons-list v0.1.0(file:///projects/cons-list)error[E0072]:recursivetype`List`has infinite size-->src/main.rs:1:1|1|enumList{|^^^recursivetypehas infinite size2|Cons(i32,List),|---recursive without indirection|help:insert someindirection(e.g.,a`Box`,...
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 indirection (e.g., a `Box`, `Rc`, or `&`) at some point to...
(i32, List), | --- recursive without indirection | help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable | 2 | Cons(i32, Box<List>), | ++++ + For more information about this error, try `rustc --explain E0072`. error: could not comp...
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 indirection (e.g., a `Box`, `Rc`, or `&`) at some point to...
error[E0072]: recursive type `List` has infinite size //递归类型 `List` 拥有无限长的大小--> src/main.rs:3:1|3 | enum List {| ^^^ recursive type has infinite size4 | Cons(i32, List),| --- recursive without indirection 此时若想解决...
| --- recursive without indirection | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `List` representable 示例15-4:尝试定义一个递归枚举时得到的错误 这个错误表明这个类型 “有无限的大小”。其原因是List的一个成员被定义为是递归的:它直接存放了另一个相...