Rust 1.65.0稳定版发布,泛型关联类型(GATs)正式稳定
出品 | OSC开源社区(ID:oschina2013)
Rust 1.65.0 稳定版已发布初始化错误 。此版本包含多项重要的语法变更,以及编辑器和标准库方面的改动。值得关注的是,Rust 1.65 现在还启用了 MIR 内联来优化编译,为 crate 提供了 3-10% 的编译时间改进。
语言特性
为枚举类型使用 #[non_exhaustive] 变体进行 as 转换添加错误处理
let else 正式稳定
letPATTERN: TYPE = EXPRESSION else{
DIVERGING_CODE;
泛型关联类型 (Generic Associated Types, GATs) 正式稳定
Lifetime、type 和 const 泛型现在可以在关联类型上进行定义初始化错误 ,如下所示:
traitFoo {
typeBar< 'x>;
下面是一些使用示例:
/// An `Iterator`-like trait that can borrow from `Self`
traitLendingIterator {
type Item< 'a> where Self: 'a;
fn next< 'a>(&'a mut self) -> Option< Self::Item< 'a>>;}
/// Can be implemented over smart pointers, like `Rc` or `Arc`,/// in order to allow being generic over the pointer typetrait PointerFamily {type Pointer<T>: Deref<Target = T>;
fn new<T>(value: T) -> Self::Pointer<T>;}
/// Allows borrowing an array of items. Useful for/// `NdArray`-like types that don't necessarily store /// data contiguously.traitBorrowArray<T> { type Array< 'x, const N: usize> where Self: 'x;
fn borrow_array< 'a, const N: usize>(&'a self) -> Self::Array< 'a, N>;}
从 Clippy 添加 lints let_underscore_drop , let_underscore_lock 和 let_underscore_must_use
未初始化的整数、浮点数和原始指针现在会被视作未定义行为 (immediate UB)
适用于 Windows x86_64, aarch64 和 thumbv7a 架构的 raw-dylib 正式稳定
不允许在外部 ADTs 中 Drop impl
编译器
Linux 上的 -Csplit-debuginfo 正式稳定
当存在多个变体拥有数据时初始化错误 ,使用 niche-filling 进行优化
关联类型 projections 现在在解析基础类型之前会被验证为格式正确
调整大小时会对结构字段类型进行规范化
将 LLVM 版本升级到 15
修复 aarch64 call abi 以确保 zeroext 正确运行
debuginfo: 为枚举泛化类似 C++ 的编码
添加 special_module_name lint
使用 -C instrument-coverage 时初始化错误 ,增加对默认生成唯一的 profraw 文件的支持
支持面向 iOS/tvOS targets 进行动态链接
标准库
不再在派生 (PartialEq) 中生成 PartialEq::ne
Windows RNG:默认使用 BCRYPT_RNG_ALG_HANDLE
禁止将 System 与 direct system allocator 调用混合使用
Document 不再支持写入非阻塞 stdio/stderr
详情查看 Release Note( )初始化错误 。
【OSCHINA 2022 中国开源开发者问卷】 来啦
初始化错误 你的反馈将有助于反映中国开源的全貌
问卷结尾还可抽取初始化错误 我们的周边好物哦~
期待来自你的反馈初始化错误 !
微软做初始化错误 了谷歌做不到的事
已超1000万行代码初始化错误 ,Java再次输给了Kotlin... 刚标准化就被废弃,谷歌:不爱了
这里有最新开源资讯、软件更新、技术干货等内容
点这里 ↓↓↓ 记得 关注✔ 标星⭐ 哦~
爱资源吧版权声明:以上文中内容来自网络,如有侵权请联系删除,谢谢。