当前位置: 首页 > news >正文

Rust 1.91.0 发布:新增平台支持与安全增强

Rust 1.91.0 发布

2025 年 10 月 30 日 · Rust 发布团队

Rust 团队很高兴宣布 Rust 1.91.0 新版本的发布。Rust 是一种编程语言,旨在让每个人都能构建可靠且高效的软件。

如果您已通过 rustup 安装了旧版 Rust,可以通过以下命令获取 1.91.0 版本:

$ rustup update stable

如果尚未安装 rustup,可以从我们网站的相应页面获取,并查看 1.91.0 的详细发布说明。

如果您希望通过测试未来版本来帮助我们,可以考虑在本地更新以使用 beta 频道(rustup default beta)或 nightly 频道(rustup default nightly)。请报告您可能遇到的任何错误!

1.91.0 稳定版中的新内容

aarch64-pc-windows-msvc 现为 Tier 1 平台

Rust 编译器支持多种目标平台,但 Rust 团队无法为所有平台提供相同级别的支持。为了明确标记每个平台的支持程度,我们采用了分级系统:

  • Tier 3 目标:编译器在技术上支持,但我们不检查其代码是否构建或通过测试,并且不提供预构建二进制文件作为发布的一部分。
  • Tier 2 目标:保证能够构建,我们提供预构建二进制文件,但不在这些平台上执行测试套件:生成的二进制文件可能无法工作或可能存在错误。
  • Tier 1 目标:提供最高级别的支持保证,我们在编译器每次合并更改时在这些平台上运行完整的测试套件。同时提供预构建二进制文件。

Rust 1.91.0 将 aarch64-pc-windows-msvc 目标提升为 Tier 1 支持,为运行 Windows 的 64 位 ARM 系统用户带来我们的最高保证。

新增针对局部变量悬空原始指针的 lint 检查

虽然 Rust 的借用检查器防止返回悬空引用,但它不跟踪原始指针。在此版本中,我们添加了一个默认警告的 lint,用于检查从函数返回的局部变量原始指针。例如,类似以下的代码:

fn f() -> *const u8 {let x = 0;&x
}

现在会产生 lint 警告:

warning: a dangling pointer will be produced because the local variable `x` will be dropped--> src/lib.rs:3:5|
1 | fn f() -> *const u8 {|           --------- return type of the function is `*const u8`
2 |     let x = 0;|         - `x` is part the function and will be dropped at the end of the function
3 |     &x|     ^^|= note: pointers do not have a lifetime; after returning, the `u8` will be deallocatedat the end of the function because nothing is referencing it as far as the type system isconcerned= note: `#[warn(dangling_pointers_from_locals)]` on by default

请注意,上述代码本身并不不安全,因为它没有执行任何危险操作。只有在函数返回后解引用原始指针才是不安全的。我们预计未来的 Rust 版本将增加更多功能,帮助开发者安全地与原始指针以及更广泛的不安全代码进行交互。

稳定的 API

  • Path::file_prefix
  • AtomicPtr::fetch_ptr_add
  • AtomicPtr::fetch_ptr_sub
  • AtomicPtr::fetch_byte_add
  • AtomicPtr::fetch_byte_sub
  • AtomicPtr::fetch_or
  • AtomicPtr::fetch_and
  • AtomicPtr::fetch_xor
  • {integer}::strict_add
  • {integer}::strict_sub
  • {integer}::strict_mul
  • {integer}::strict_div
  • {integer}::strict_div_euclid
  • {integer}::strict_rem
  • {integer}::strict_rem_euclid
  • {integer}::strict_neg
  • {integer}::strict_shl
  • {integer}::strict_shr
  • {integer}::strict_pow
  • i{N}::strict_add_unsigned
  • i{N}::strict_sub_unsigned
  • i{N}::strict_abs
  • u{N}::strict_add_signed
  • u{N}::strict_sub_signed
  • PanicHookInfo::payload_as_str
  • core::iter::chain
  • u{N}::checked_signed_diff
  • core::array::repeat
  • PathBuf::add_extension
  • PathBuf::with_added_extension
  • Duration::from_mins
  • Duration::from_hours
  • impl PartialEq<str> for PathBuf
  • impl PartialEq<String> for PathBuf
  • impl PartialEq<str> for Path
  • impl PartialEq<String> for Path
  • impl PartialEq<PathBuf> for String
  • impl PartialEq<Path> for String
  • impl PartialEq<PathBuf> for str
  • impl PartialEq<Path> for str
  • Ipv4Addr::from_octets
  • Ipv6Addr::from_octets
  • Ipv6Addr::from_segments
  • impl<T> Default for Pin<Box<T>> where Box<T>: Default, T: ?Sized
  • impl<T> Default for Pin<Rc<T>> where Rc<T>: Default, T: ?Sized
  • impl<T> Default for Pin<Arc<T>> where Arc<T>: Default, T: ?Sized
  • Cell::as_array_of_cells
  • u{N}::carrying_add
  • u{N}::borrowing_sub
  • u{N}::carrying_mul
  • u{N}::carrying_mul_add
  • BTreeMap::extract_if
  • BTreeSet::extract_if
  • impl Debug for windows::ffi::EncodeWide<'_>
  • str::ceil_char_boundary
  • str::floor_char_boundary
  • impl Sum for Saturating<u{N}>
  • impl Sum<&Self> for Saturating<u{N}>
  • impl Product for Saturating<u{N}>
  • impl Product<&Self> for Saturating<u{N}>

以下先前稳定的 API 现在在常量上下文中也稳定:

  • <[T; N]>::each_ref
  • <[T; N]>::each_mut
  • OsString::new
  • PathBuf::new
  • TypeId::of
  • ptr::with_exposed_provenance
  • ptr::with_exposed_provenance_mut

平台支持

  • aarch64-pc-windows-msvc 提升为 Tier 1。
  • aarch64-pc-windows-gnullvmx86_64-pc-windows-gnullvm 提升为 Tier 2,并提供主机工具。
  • 注意:llvm-tools 和 MSI 安装程序目前缺失,但将在未来版本中添加。

有关 Rust 分级平台支持的更多信息,请参阅 Rust 的平台支持页面。

其他更改

查看 Rust、Cargo 和 Clippy 中的所有更改。

1.91.0 的贡献者

许多人共同创建了 Rust 1.91.0。没有大家的共同努力,我们无法完成这项工作。谢谢!
更多精彩内容 请关注我的个人公众号 公众号(办公AI智能小助手)
对网络安全、黑客技术感兴趣的朋友可以关注我的安全公众号(网络安全技术点滴分享)

公众号二维码

公众号二维码

http://www.jsqmd.com/news/46099/

相关文章:

  • 2025 年 11 月战略/供应链管理咨询公司权威推荐榜单:供应链管理咨询机构,战略管理咨询服务机构,企业战略管理咨询公司,供应链顾问公司精选排行
  • 2025 年 11 月精密行星减速机厂家推荐排行榜,精密行星/微型精密行星/重载精密行星/人形精密行星/关节精密行星减速机/减速器公司精选
  • 2025 年 11 月薪酬绩效管理咨询公司推荐排行榜,薪酬体系搭建,企业绩效考核,薪酬设计,薪酬规划,薪酬绩效顾问公司推荐
  • 2025 年 11 月模具厂家推荐排行榜,精密模具,塑胶模具,精密注塑模具,高精密模具,高精度塑胶模具公司推荐
  • 2025 年 11 月吹塑厂家推荐排行榜,中空吹塑,吹塑制品/玩具,吹塑瓶/容器瓶/泡泡水瓶/机油瓶,洗发水/沐浴露/医药瓶/化妆瓶公司推荐
  • 2025 年 11 月热流道发热圈厂家推荐排行榜,铜套/弹簧/钢套/瓶盖/云母发热圈,翅片干烧发热管公司推荐,专业制造与高效性能口碑之选
  • 2025 年 11 月塑胶容器厂家推荐排行榜,塑料容器,透明塑胶容器,吹塑容器,容器瓶,医药容器公司精选
  • first sql有用处吗
  • first sql怎么写呢
  • first sql有啥要点
  • AI元人文:论“静默运维”与“悟空时刻”——阈值触发的人机共舞
  • find -name linux
  • fdisk在Linux中怎样分配磁盘空间
  • 应用安全 --- IDA脚本 之 导出函数调用链
  • excel怎么读取mysql数据库
  • es的sql语句 能进行聚合吗
  • AI元人文:规则时序的重构——从线性控制到循环涌现
  • 克劳狄乌斯与沉船
  • AI元人文:人性与规则的协同演化——一场永不停息的共舞
  • 博客重启声明
  • Codeforces Round 1065 (Div. 3) 题解
  • Debian 12/13可用的华宇输入法 .deb 14M安装后 40M 词很多
  • 2025沈阳防水补漏服务推荐:极冠快修,全国连锁品牌深耕沈阳本土,凭实力出圈
  • 【Kubernetes】集成Prometheus + Grafana监控
  • Debian 12/13可用的华宇输入法, .deb 14M安装后 40M,词很多
  • XHORSE XZPG00EN Special PCB Board for Peugeot Citroen DS – 5pcs/lot for Reliable Repairs
  • 从原则到协议:价值原语化——多元共生AI伦理的技术实现范式
  • Swift 多线程读变量安全吗?
  • Xhorse BMW G-Chassis BDC02 IMMO Authorization for Key Tool Plus, VVDI2, MIDI
  • 从原则到协议:论价值原语化多元共生AI伦理的技术化实现范式