Rust 1.99.0 稳定 C-ABI 可变参数函数;1.99.1 修复 FFI 布尔返回值误编译与 UEFI 链接错误
Rust 项目于 2026 年 10 月 1 日发布 Rust 1.99.0,随后于 10 月 15 日发布点版本 1.99.1。两者均可通过 `rustup update stable` 获取。
1.99.0 的主要特性是稳定了对在 Rust 中直接定义 C-ABI 可变参数函数的支持(支持 "C" 和 "C-unwind" ABI);此前 Rust 已能调用外部定义的可变参数函数(如 libc 的 printf),现在可以通过 VaList 和 VaArgSafe trait 自行编写。该版本还稳定了 Layout::for_value_raw、mem::size_of_val_raw 和 mem::align_of_val_raw,用于从裸指针获取大小和对齐信息,并稳定了 Box::into_non_null、Vec::into_parts/from_parts、String::from_utf8_lossy_owned、std::fs::set_times 等 API。Box::leak 的文档现在建议不要在之后释放泄漏的内存,因为这类模式会与编译器优化和自定义分配器产生不良交互,应优先使用 Box::into_non_null 或 Box::into_raw。
Rust 1.99.1 修复了三个回归问题:部分目标平台缺失 wcslen 符号导致链接错误,并使所有使用 std 的项目无法在 UEFI 目标上构建;x86_64 上 FFI 布尔返回值被误编译,调用方可能观察到 0 或 1 以外的值;以及在未通过 rustup 代理调用时 rust-lld 无法在 macOS 上加载 libLLVM。
报告未说明 FFI 布尔返回值误编译是由哪个先前版本引入的,因此在 x86_64 上进行 FFI 开发或面向 UEFI 目标的开发者应升级并检查当前工具链版本。
Rust 1.99.0 stabilizes C-ABI variadic functions; 1.99.1 fixes FFI bool miscompilation and UEFI link errors
The Rust project released Rust 1.99.0 on October 1, 2026, followed by a point release 1.99.1 on October 15, 2026. Both are available via `rustup update stable`.
The main feature in 1.99.0 is stable support for defining C-ABI variadic functions (with the "C" and "C-unwind" ABIs) directly in Rust; Rust could already call externally defined variadics such as libc printf, but can now write them using a VaList and the VaArgSafe trait. The release also stabilizes Layout::for_value_raw, mem::size_of_val_raw and mem::align_of_val_raw for retrieving size and alignment from raw pointers, along with APIs such as Box::into_non_null, Vec::into_parts/from_parts, String::from_utf8_lossy_owned, and std::fs::set_times. The documentation for Box::leak now recommends against later deallocating the leaked memory, because such patterns interact badly with compiler optimizations and custom allocators; Box::into_non_null or Box::into_raw are preferred instead.
Rust 1.99.1 addresses three regressions: a missing wcslen symbol that caused link errors on some targets and broke UEFI targets for any project using std; a miscompilation of FFI bool return values on x86_64 where callers could observe values other than 0 or 1; and rust-lld failing to load libLLVM on macOS when invoked without the rustup proxy.
The reports do not state which prior releases introduced the FFI bool miscompilation, so developers doing FFI work on x86_64 or targeting UEFI should upgrade and check their current toolchain version.