ZhangHanDong / tao-of-rust-codes

《Rust编程之道》随书源码
https://ruststudy.github.io/tao_of_rust_docs/tao_of_rust/
MIT License
1.18k stars 170 forks source link

第44页的代码清单2-5注释错误 #322

Closed Cyberlin closed 3 years ago

Cyberlin commented 3 years ago

页码与行数


文本或排版错误

暂无


代码注释错误

fn main() {
    let place1 = "hello";
    let place2 = "hello".to_string();
    let other = place1;
    println!("{:?}", other);
    let other = place2;
    println!("{:?}", other);//Err: other value used here after move
}

实际上运行没有报错 image

Rust版本

$  rustc -V
rustc 1.52.1 (9bc8c42bb 2021-05-09)

错误信息

代码注释错误
ZhangHanDong commented 3 years ago

多谢反馈,这个问题已经重复反馈了,也在后来的印刷版修复了。可以对照下已提交的issues。 这个示例本来是要 示范 编译错误的,但是后来在交稿的时候,我又把这个示例的错误给改回来了,乌龙了。