Rust 1.42.0 发布

Rust 1.42.0 现已发布,该版本的亮点包括:unwrapping 时更有用的紧急消息、分段模式、弃用Error::description等等。具体更新内容如下:

Language

  1. 在特性定义中,在句法之前允许使用 default
  2. 包含在 impls 中的项目(即 const,type 和 fns)在语法上可能会遗漏它们的主体以支持 ;.
  3. 现在,语法上允许在 impls 中关联类型的界限(例如type Foo: Ord; )。
  4. ... (C 变量类型)可以在语法上直接作为任何函数参数的类型出现。

这些仍然在语义上被拒绝,因此用户可能会收到一个错误,但是这些更改可以通过过程宏和条件编译来查看和解析。

Compiler

  • 添加 tier 2* 以支持 armv7a-none-eabi
  • 添加 tier 2 以支持riscv64gc-unknown-linux-gnu
  • Option::{expect,unwrap} 和Result::{expect, expect_err, unwrap, unwrap_err} 现在会产生紧急消息,这些消息指向被调用的位置,而不是内核的内部。

Libraries

  • iter::Empty<T> 现在为任何 T实现发送和同步。
  • Pin::{map_unchecked, map_unchecked_mut} 不再需要返回类型来实现 Sized。
  • io::Cursor 现在 derives PartialEq 和 Eq
  • Layout::new 现在是 const
  • 增加了对riscv64gc-unknown-linux-gnu的标准库支持。

Stabilized APIs

相容性说明

  • Error::description已被弃用,现在将产生警告。建议使用Displayto_string代替。

更多详细信息可查看发布说明: https://blog.rust-lang.org/2020/03/12/Rust-1.42.htm

猜你喜欢

转载自www.oschina.net/news/114076/rust-1-42-0-released