Rust 1.26.2 已发布,Rust 是一门专注于安全性,速度和并发性的系统编程语言。 如果你已安装过 Rust,升级至 Rust 1.26.2 非常方便 $ rustup update stable 该补丁版本修复了 let mut foo = Some("foo".to_string()); let bar = &mut foo; match bar { Some(baz) => { bar.take(); // Should not be permitted, as baz has a unique reference to the bar pointer. }, None => unreachable!(), } 1.26.2 将拒绝上面的代码,并显示以下错误消息: error[E0499]: cannot borrow `*bar` as mutable more than once at a time --> src/main.rs:6:9 | 5 | Some(baz) => { | --- first mutable borrow occurs here 6 | bar.take(); // Should not be permitted, as baz has a ... | ^^^ second mutable borrow occurs here ... 9 | } | - first borrow ends here error: aborting due to previous error 详细更新说明请查看 https://blog.rust-lang.org/2018/06/05/Rust-1.26.2.html |