// 看起来,更像是Rc::new(Node { data: 2, next: None })
let second = Rc::new(Node { data: 2, next: Some(first.clone()) });
文本错误
接下来的编译报错信息,(新版本中?)是更友好的cannot assign
(不影响上文的改动)
|
14 | first.next = Some(second.clone());
| ^^^^^^^^^^ cannot assign
|
= help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc<Node<i32>>`
页码与行数
代码错误
文本错误
接下来的编译报错信息,(新版本中?)是更友好的
cannot assign
(不影响上文的改动)Rust版本
stable version 1.54.0
rust playground link
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eb1e39f17f47d3bdfe71df856692a673