Draft Release Notes For 1.87

by ADMIN 29 views

Introduction

This document outlines the key changes and improvements in Rust 1.87.0, which was released on 2023-05-15. The release includes a range of language, compiler, and library changes, as well as updates to Cargo and Rustdoc.

Language

Stabilized Features

  • asm_goto feature: The asm_goto feature has been stabilized, allowing developers to use assembly language in their Rust code.
  • Precise capturing in traits: The feature(precise_capturing_in_traits) feature has been stabilized, allowing developers to use precise capturing in traits.

Other Changes

  • Allow parsing open beginning ranges after unary operators: The compiler now allows parsing open beginning ranges after unary operators.
  • Don't require method impls for methods with Self: Sized bounds in impls for unsized types: The compiler no longer requires method impls for methods with Self: Sized bounds in impls for unsized types.
  • Stabilize feature(precise_capturing_in_traits) allowing use<...> bounds on return position impl Trait in traits: The feature(precise_capturing_in_traits) feature has been stabilized, allowing developers to use use<...> bounds on return position impl Trait in traits.

Compiler

x86 Changes

  • Make SSE2 required for i686 targets and use it to pass SIMD types: The compiler now requires SSE2 for i686 targets and uses it to pass SIMD types.

Platform Support

For more information on Rust's tiered platform support, please refer to the platform support page.

Libraries

Stabilized APIs

  • Vec::extract_if: The Vec::extract_if method has been stabilized.
  • vec::ExtractIf: The vec::ExtractIf type has been stabilized.
  • LinkedList::extract_if: The LinkedList::extract_if method has been stabilized.
  • linked_list::ExtractIf: The linked_list::ExtractIf type has been stabilized.
  • <[T]>::split_off: The <[T]>::split_off method has been stabilized.
  • <[T]>::split_off_mut: The <[T]>::split_off_mut method has been stabilized.
  • <[T]>::split_off_first: The <[T]>::split_off_first method has been stabilized.
  • <[T]>::split_off_first_mut: The <[T]>::split_off_first_mut method has been stabilized.
  • <[T]>::split_off_last: The <[T]>::split_off_last method has been stabilized.
  • <[T]>::split_off_last_mut: The <[T]>::split_off_last_mut method has been stabilized.
  • String::extend_from_within: The String::extend_from_within method has been stabilized.
  • os_str::Display: The os_str::Display trait has been stabilized.
  • OsString::display: The OsString::display method been stabilized.
  • OsStr::display: The OsStr::display method has been stabilized.
  • io::pipe: The io::pipe function has been stabilized.
  • io::PipeReader: The io::PipeReader type has been stabilized.
  • io::PipeWriter: The io::PipeWriter type has been stabilized.
  • impl From<PipeReader> for OwnedHandle: The impl From<PipeReader> for OwnedHandle implementation has been stabilized.
  • impl From<PipeWriter> for OwnedHandle: The impl From<PipeWriter> for OwnedHandle implementation has been stabilized.
  • impl From<PipeReader> for Stdio: The impl From<PipeReader> for Stdio implementation has been stabilized.
  • impl From<PipeWriter> for Stdio: The impl From<PipeWriter> for Stdio implementation has been stabilized.
  • impl From<PipeReader> for OwnedFd: The impl From<PipeReader> for OwnedFd implementation has been stabilized.
  • impl From<PipeWriter> for OwnedFd: The impl From<PipeWriter> for OwnedFd implementation has been stabilized.
  • Box::write: The Box::write method has been stabilized.
  • impl TryFrom<Vec<u8>> for String: The impl TryFrom<Vec<u8>> for String implementation has been stabilized.

Other Changes

  • Undeprecate env::home_dir: The env::home_dir function has been undeprecated.
  • Denote ControlFlow as #[must_use]: The ControlFlow type has been denoted as #[must_use].
  • Macros such as assert_eq! and vec! now support const {...} expressions: Macros such as assert_eq! and vec! now support const {...} expressions.

Cargo

Changes

  • Add terminal integration via ANSI OSC 9;4 sequences: Cargo now supports terminal integration via ANSI OSC 9;4 sequences.
  • Bump openssl to v3: Cargo has been updated to use openssl v3.
  • Add --exclude-lockfile flag: The --exclude-lockfile flag has been added to Cargo.

Rustdoc

Changes

  • No changes: There are no changes to Rustdoc in this release.

Compatibility Notes

Changes

  • Rust now raises an error for macro invocations inside the #![crate_name] attribute: Rust now raises an error for macro invocations inside the #![crate_name] attribute.
  • Unstable fields are now always considered to be inhabited: Unstable fields are now always considered to be inhabited.
  • Macros ??? may ?? break now ??? due to ranges and unary operators ??? idk ?: Macros may break now due to ranges and unary operators.
  • Make Debug impl of raw pointers print metadata if present: The Debug impl of raw pointers now prints metadata if present.
  • Associated types on dyn types are no longer deduplicated: Associated types on dyn types are no longer deduplicated.
  • Forbid attributes on .. inside of struct patterns ( Struct { #[attribute] .. }) =: Attributes are no longer allowed on .. inside of struct patterns.
  • Many std::arch intrinsics are now safe to call in some contexts, there may now be new unused_unsafe warnings in existing codebases: Many std::arch intrinsics are now safe to call in some contexts, which may result in new unused_unsafe warnings in existing codebases.
  • Limit width and precision formatting options to 16 bits on all targets: The width and precision formatting options are now limited to 16 bits on all targets.
  • Turn order dependent trait objects future incompat warning into a hard error: The order dependent trait objects future incompat warning has been turned into a hard error.
  • Denote ControlFlow as #[must_use]: The ControlFlow type has been denoted as #[must_use].
  • Remove i586-pc-windows-msvc target: The i586-pc-windows-msvc target has been removed.
  • Windows: The standard library no longer links advapi32, except on win7: The standard library no longer links advapi32, except on win7.
  • Warn against function pointers using unsupported ABI strings in dependencies: Function pointers using unsupported ABI strings in dependencies are now warned against.
  • Make ptr_cast_add_auto_to_object lint into hard error: The ptr_cast_add_auto_to_object lint has been turned into a hard error.

Internal Changes

Changes

  • Update to LLVM 20: Rust has been updated to use LLVM 20.
  • Other changes: There are other internal changes that do not affect any public interfaces of Rust, but represent significant improvements to the performance or internals of rustc and related tools.
    Q&A: Rust 1.87 Release Notes ==============================

Q: What are the key changes in Rust 1.87?

A: The key changes in Rust 1.87 include the stabilization of several features, such as asm_goto and precise_capturing_in_traits, as well as updates to the compiler, libraries, and Cargo.

Q: What is the significance of the asm_goto feature?

A: The asm_goto feature allows developers to use assembly language in their Rust code, which can be useful for low-level programming and performance-critical code.

Q: What is the purpose of the precise_capturing_in_traits feature?

A: The precise_capturing_in_traits feature allows developers to use precise capturing in traits, which can be useful for creating more expressive and flexible trait bounds.

Q: What changes were made to the compiler in Rust 1.87?

A: The compiler was updated to require SSE2 for i686 targets and to use it to pass SIMD types. Additionally, the compiler now raises an error for macro invocations inside the #![crate_name] attribute.

Q: What changes were made to the libraries in Rust 1.87?

A: Several libraries were updated, including the stabilization of APIs such as Vec::extract_if and String::extend_from_within. Additionally, the ControlFlow type was denoted as #[must_use].

Q: What changes were made to Cargo in Rust 1.87?

A: Cargo was updated to support terminal integration via ANSI OSC 9;4 sequences and to bump openssl to v3. Additionally, the --exclude-lockfile flag was added to Cargo.

Q: What are the compatibility notes for Rust 1.87?

A: The compatibility notes for Rust 1.87 include changes such as the removal of the i586-pc-windows-msvc target, the limitation of width and precision formatting options to 16 bits on all targets, and the turn of the order dependent trait objects future incompat warning into a hard error.

Q: What are the internal changes in Rust 1.87?

A: The internal changes in Rust 1.87 include the update to LLVM 20 and other changes that do not affect any public interfaces of Rust, but represent significant improvements to the performance or internals of rustc and related tools.

Q: How can I get started with Rust 1.87?

A: To get started with Rust 1.87, you can update your Rust installation to the latest version and start exploring the new features and changes. You can also refer to the official Rust documentation and community resources for more information and support.

Q: What are the benefits of using Rust 1.87?

A: The benefits of using Rust 1.87 include improved performance, better safety, and increased expressiveness. Additionally, the new features and changes in Rust 1.87 provide more flexibility and options for developers, making it easier to write high-quality and maintainable code.