原文: https://www.oschina.net/news/273247/rust-1-75-0-released
Rust 1.75.0 稳定版已正式发布,主要带来以下变化:
traits 中的 async fn
和 return-position impl Trait
Rust 1.75 支持在 Trait 中使用 async fn
和 -> impl Trait
。但是,此初始版本存在公告帖子中描述的一些限制。
预计这些限制将在未来的版本中取消。
指针字节偏移 API
原始指针(*const T
和 *mut T
)主要用于支持以 T
为单位的操作。例如,<*const T>::add(1)
将 size_of::<T>()
字节添加到指针的地址。在某些情况下,使用字节偏移量更方便,并且这些新 API 避免了要求调用者首先强制转换为 *const u8
/ *mut u8
。
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
rustc 的代码布局优化
Rust 编译器的运行速度继续加快,此次发布的二进制版本采用了 BOLT 技术,使基准测试平均运行时间提高了 2%。该工具优化了包含大部分 rustc 代码的 librustc_driver.so 库的布局,从而提高了缓存利用率。
现在还在使用 -Ccodegen-units=1 构建 rustc,为在 LLVM 中进行优化提供了更多机会。这一优化为基准测试带来了 1.5% 的平均运行时间平均提升。
在此版本中,这些优化仅限于 x86_64-unknown-linux-gnu 编译器。项目团队计划随着时间的推移将其扩展到更多平台。
稳定的 API
Atomic*::from_ptr
FileTimes
FileTimesExt
File::set_modified
File::set_times
IpAddr::to_canonical
Ipv6Addr::to_canonical
Option::as_slice
Option::as_mut_slice
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
这些 API 现在在 const contexts 中是稳定的:
Ipv6Addr::to_ipv4_mapped
MaybeUninit::assume_init_read
MaybeUninit::zeroed
mem::discriminant
mem::zeroed
其他变化
查看 Rust、Cargo 和 Clippy 中发生的所有变化。
详情可查看官方公告。
官方公告:
Announcing Rust 1.75.0
Announcing Rust 1.75.0
The Rust team is happy to announce a new version of Rust, 1.75.0. Rust is a programming language empowering everyone to build reliable and efficient software.
If you have a previous version of Rust installed via rustup, you can get 1.75.0 with:
rustup update stable
If you don’t have it already, you can get rustup
from the appropriate page on our website, and check out the detailed release notes for 1.75.0.
If you’d like to help us out by testing future releases, you might consider updating locally to use the beta channel (rustup default beta
) or the nightly channel (rustup default nightly
). Please report any bugs you might come across!
What’s in 1.75.0 stable
async fn
and return-position impl Trait
in traits
As announced last week, Rust 1.75 supports use of async fn
and -> impl Trait
in traits. However, this initial release comes with some limitations that are described in the announcement post.
It’s expected that these limitations will be lifted in future releases.
Pointer byte offset APIs
Raw pointers (*const T
and *mut T
) used to primarily support operations operating in units of T
. For example, <*const T>::add(1)
would add size_of::<T>()
bytes to the pointer’s address. In some cases, working with byte offsets is more convenient, and these new APIs avoid requiring callers to cast to *const u8
/*mut u8
first.
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
Code layout optimizations for rustc
The Rust compiler continues to get faster, with this release including the application of BOLT to our binary releases, bringing a 2% mean wall time improvements on our benchmarks. This tool optimizes the layout of the librustc_driver.so
library containing most of the rustc code, allowing for better cache utilization.
We are also now building rustc with -Ccodegen-units=1
, which provides more opportunity for optimizations in LLVM. This optimization brought a separate 1.5% wall time mean win to our benchmarks.
In this release these optimizations are limited to x86_64-unknown-linux-gnu
compilers, but we expect to expand that over time to include more platforms.
Stabilized APIs
Atomic*::from_ptr
FileTimes
FileTimesExt
File::set_modified
File::set_times
IpAddr::to_canonical
Ipv6Addr::to_canonical
Option::as_slice
Option::as_mut_slice
pointer::byte_add
pointer::byte_offset
pointer::byte_offset_from
pointer::byte_sub
pointer::wrapping_byte_add
pointer::wrapping_byte_offset
pointer::wrapping_byte_sub
These APIs are now stable in const contexts:
Ipv6Addr::to_ipv4_mapped
MaybeUninit::assume_init_read
MaybeUninit::zeroed
mem::discriminant
mem::zeroed
Other changes
Check out everything that changed in Rust, Cargo, and Clippy.
Contributors to 1.75.0
Many people came together to create Rust 1.75.0. We couldn’t have done it without all of you. Thanks!
SCISE® 是本站注册商标
发表回复