Skip to content
The Chat Archive
gpt-4o-mini-search-preview· OpenAI LMArena Search Arena 24K

what's new in the latest release of rust lang

  1. User

    what's new in the latest release of rust lang

  2. Assistant

    The latest stable release of Rust is version 1.83.0, which became available on November 28, 2024[1].

    Language Enhancements:

    • Const Context Improvements: The release stabilizes the use of &mut, *mut, &Cell, and *const Cell within constant contexts, allowing for more flexible and efficient code in const functions.

    • Static References in Const Initializers: It's now possible to create references to static items within const initializers, enhancing the expressiveness of constant definitions.

    • Raw Lifetimes and Labels: The introduction of raw lifetimes and labels ('r#ident) provides a more precise way to annotate lifetimes, improving code clarity and safety.

    • Atomic and Non-Atomic Reads: The behavior when atomic and non-atomic reads race has been clearly defined, ensuring more predictable and reliable concurrent programming.

    • Non-Exhaustive Structs: Non-exhaustive structs can now be empty, offering greater flexibility in struct definitions.

    • Disallow Implicit Coercions from !: Implicit coercions from the never type ! are now disallowed, preventing potential logical errors in code.

    • const extern Functions: It's now possible to define const extern functions for other calling conventions, expanding the interoperability of constant functions.

    • Stabilization of expr_2021 Macro Fragment Specifier: The expr_2021 macro fragment specifier has been stabilized across all editions, standardizing macro usage.

    • non_local_definitions Lint Update: The non_local_definitions lint now triggers on less code and issues warnings by default, promoting cleaner code practices.

    Compiler Updates:

    • Deprecation of -Csoft-float Flag: The unsound -Csoft-float flag has been deprecated, encouraging the use of more reliable floating-point operations.

    • Addition of New Tier 3 Targets: Several new Tier 3 targets have been added, including:

      • aarch64_unknown_nto_qnx700

      • arm64e-apple-tvos

      • armv7-rtems-eabihf

      • loongarch64-unknown-linux-ohos

      • riscv32-wrs-vxworks and riscv64-wrs-vxworks

      • riscv32{e|em|emc}-unknown-none-elf

      • x86_64-unknown-hurd-gnu

      • x86_64-unknown-trusty

      These additions enhance Rust's support across various platforms.

    Library and Cargo Enhancements:

    • PartialEq for ExitCode: The ExitCode type now implements the PartialEq trait, facilitating easier comparisons.

    • catch_unwind Documentation: It's documented that catch_unwind can handle foreign exceptions without undefined behavior, though the exact behavior remains unspecified.

    • Default Implementation for HashMap/HashSet Iterators: Iterators for HashMap and HashSet now implement the Default trait, simplifying their initialization.

    • Unicode Version Bump: The Unicode version has been updated to 16.0.0, ensuring compatibility with the latest Unicode standards.

    • Documentation Update for ptr::add/sub: The documentation for ptr::add and ptr::sub has been revised to clarify that they are not equivalent to offset.

    Cargo and Rustdoc Improvements:

    • New CARGO_MANIFEST_PATH Environment Variable: A new environment variable, CARGO_MANIFEST_PATH, has been introduced. Similar to CARGO_MANIFEST_DIR, it points directly to the manifest file, providing more precise control over Cargo's behavior.

    • package.autolib in Manifest: The package.autolib field has been added to the manifest, allowing users to disable [lib] auto-discovery when necessary.

    • Support Level Declaration in Cargo: Crates can now declare their support level in Cargo's Charter or crate documentation, enhancing transparency and user trust.

    • Intentional Artifacts as 'Small' Changes: New Intentional Artifacts are now declared as 'small' changes, streamlining the release process.

    • Rustdoc Sidebar Enhancement: The sidebar (hamburger menu) table of contents in Rustdoc now includes the # headers from the main item's documentation comment, improving navigation and usability.

    Compatibility Notes:

    • Function Pointer ABI Warnings: Warnings have been introduced for function pointers using unsupported ABI strings, promoting safer and more compatible code.

    • Type Signature Checks in Function Pointer Casts: The compiler now checks the well-formedness of the source type's signature in function pointer casts, addressing a soundness issue related to casting function items to function pointers.

    • Equality in Type Dependent Paths: Equality is now used instead of subtyping when resolving type-dependent paths, enhancing type resolution accuracy.

    • macOS Linking Behavior: Linking on macOS now correctly includes Rust's default deployment target. Users may need to adjust the MACOSX_DEPLOYMENT_TARGET or modify #[link] attributes to point to the correct frameworks.

    • Error for repr(Rust) on Non-Struct/Enum/Union Items: Rust now raises an error for repr(Rust) applied to non-struct/enum/union items, as it previously had no effect.

    • **Hard Error for `deprecated_cfg_attr_crate_type_name

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.