返回资讯中心
外部精选
后端
#Rust#版本发布

Announcing Rust 1.99.0

The Rust team is happy to announce a new version of Rust, 1.99.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,…

Rust BlogThe Rust Release Team2026/10/1 · 25 天前8 分钟阅读

以下正文同步自 Rust Blog,版权归原站所有,已转换为易读排版。

The Rust team is happy to announce a new version of Rust, 1.99.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.99.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.99.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.99.0 stable extern "C" variadics Rust 1.99.0 stabilizes defining C-ABI variadic functions with "C" and "C-unwind" ABIs. Variadic functions defined this way use a variable argument list (...) and accept an arbitrary number of arguments. Rust could already call externally-defined variadic functions (e.g., libc::printf). With Rust 1.99, these functions can now be written in Rust itself: /// SAFETY: must be called with (at least) 2 i32 arguments. unsafe extern "C" fn sum(mut args: ...) -> i32 { // SAFETY: guaranteed by the caller. let a = unsafe { args.next_arg::i32>() }; let b = unsafe { args.next_arg::i32>() }; a + b } fn foo() -> i32 { unsafe { sum(0i32, 2i32) } } The type of ... is VaList, which is ABI-compatible with the C va_list type across targets. What types can be read from a VaList is guarded by the VaArgSafe trait. For more details on c-variadic functions, see the Reference. This release also stabilizes support for defining naked variadic functions with non-"C" ABIs, which must be written via inline assembly. Layout information from raw pointers This release settles the safety requirements for retrieving the size and alignment on raw pointers to both Sized (trivially safe, already possible on stable) and non-Sized types. This is done by stabilizing three functions:

  • Layout::for_value_raw
  • mem::size_of_val_raw
  • mem::align_of_val_raw Recommend against round-trip unleaking after Box::leak While there are no changes to the language semantics in Rust 1.99, we have updated the documentation on Box::leak to recommend against patterns that later deallocate that memory. This was done because such code was found to have problematic interactions with current and future potential compiler optimizations, and is especially problematic with the upcoming stabilization of custom allocators. Instead, Box::into_non_null should be preferred. This guidance also applies to other leak functions in the standard library. Stabilized APIs
  • IntoIterator for Box
  • IntoIterator for &Box
  • IntoIterator for &mut Box
  • VecDeque::retain_back
  • core::ffi::VaList
  • Box::into_non_null
  • Box::from_non_null
  • Vec::into_parts
  • Vec::from_parts
  • core::mem::size_of_val_raw
  • core::mem::align_of_val_raw
  • core::alloc::Layout::for_value_raw
  • String::from_utf8_lossy_owned
  • string::FromUtf8Error::into_utf8_lossy
  • FusedIterator for StepBy
  • std::fs::set_times
  • std::fs::set_times_nofollow Other changes Check out everything that changed in Rust, Cargo, and Clippy. Contributors to 1.99.0 Many people came together to create Rust 1.99.0. We couldn't have done it without all of you. Thanks!

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →