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

[第六章] 6.23小节 规则总结 第三条的第二小条有问题 #246

Closed yar999 closed 5 years ago

yar999 commented 5 years ago

页码与行数

6.23小节 规则总结 第三条的第二小条有问题:

如果不需要修改环境变量, 且使用了 move 关键字, 则自动实现 Fn.

通过下面的代码证明上面第三条的第二小条有问题:

    let x = vec![0];
    let expend_x = move || x;
    // expend_x.call(()); // 3.2 不修改环境变量,使用了move但是只实现了 FnOnce.
    expend_x.call_once(());
ZhangHanDong commented 5 years ago

@yar999 感谢反馈,回头我确认下