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

栏目: 软件资讯 · 发布时间: 7年前

内容简介:Rust 1.26.2 已发布,Rust 是一门专注于安全性,速度和并发性的系统编程语言。 如果你已安装过 Rust,升级至 Rust 1.26.2 非常方便 $ rustup update stable 该补丁版本修复了 match 表达式中的关于  borro...

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


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上所述就是小编给大家介绍的《Rust 1.26.2 发布,Mozilla 开发的系统编程语言》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

HTML & XHTML

HTML & XHTML

Chuck Musciano、Bill Kennedy / O'Reilly Media / 2006-10-27 / GBP 39.99

"...lucid, in-depth descriptions of the behavior of every HTML tag on every major browser and platform, plus enough dry humor to make the book a pleasure to read." --Edward Mendelson, PC Magazine "Whe......一起来看看 《HTML & XHTML》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具