设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Rust 1.26.2发布,Mozilla开发的系统编程语言

2018-6-6 21:44| 发布者: joejoe0332| 查看: 306| 评论: 0|原作者: oschina|来自: oschina

摘要: Rust 1.26.2 已发布,Rust 是一门专注于安全性,速度和并发性的系统编程语言。如果你已安装过 Rust,升级至 Rust 1.26.2 非常方便$rustupupdatestable该补丁版本修复了match表达式中的关于 borrow checker 的一个错 ...

Rust 1.26.2 已发布,Rust 是一门专注于安全性,速度和并发性的系统编程语言。

如果你已安装过 Rust,升级至 Rust 1.26.2 非常方便

$ rustup update stable

该补丁版本修复了 match 表达式中的关于  borrow checker 的一个错误。这个 bug 是在 1.26.0 版本中引入的。具体来说,它允许代码在同一时间使用两个可变的 bar 路径。

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


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部