Latest in branch 1.87
1.87.0
Released 15 May 2025
(1 year ago)
SoftwareRust
Version1.87
Initial release1.87.0
15 May 2025
(1 year ago)
Latest release1.87.0
15 May 2025
(1 year ago)
Support status26 Jun 2025
(Ended 11 months ago)
Release noteshttps://github.com/rust-lang/rust/releases/tag/1.87.0
Source codehttps://github.com/rust-lang/rust/tree/1.87.0
Downloadhttps://github.com/rust-lang/rust/releases/tag/1.87.0
Rust 1.87 ReleasesView full list

What Is New in Rust 1.87

CategoryHighlights
New FeaturesAnonymous pipes, safe architecture intrinsics, asm! jumps to Rust, precise impl Trait capturing, const-stable APIs
Breaking ChangesRemoval of i586-pc-windows-msvc target; migrate to i686-pc-windows-msvc

How can I combine stdout and stderr of a child process using anonymous pipes?

You can combine stdout and stderr by directing both streams into a single anonymous pipe created with std::io::pipe().

use std::process::Command;
use std::io::Read;

let (mut recv, send) = std::io::pipe()?;

let mut child = Command::new("my_program")
    .stdout(send.try_clone()?)
    .stderr(send)
    .spawn()?;

let mut output = Vec::new();
recv.read_to_end(&mut output)?;
assert!(child.wait()?.success());

What safety improvements were made to architecture intrinsics in Rust 1.87?

Most std::arch intrinsics that were unsafe only because they required a specific CPU feature are now callable from safe code when that feature is enabled.

#![forbid(unsafe_op_in_unsafe_fn)]
use std::arch::x86_64::*;

fn sum(slice: &[u32]) -> u32 {
    if is_x86_feature_detected!("avx2") {
        // Safe because the feature is known to be present.
        return sum_avx2(slice);
    }
    slice.iter().sum()
}

#[target_feature(enable = "avx2")]
unsafe fn sum_avx2(slice: &[u32]) -> u32 {
    // Intrinsics themselves are now safe; only the surrounding function is unsafe.
    let mut acc = _mm256_setzero_si256();
    for chunk in slice.chunks_exact(8) {
        let vec = _mm256_loadu_si256(chunk.as_ptr() as *const __m256i);
        acc = _mm256_add_epi32(acc, vec);
    }
    // Transmute is still unsafe, but the core loop is safe.
    let arr: [u32; 8] = std::mem::transmute(acc);
    arr.iter().sum()
}

How does the asm! macro now support jumping to Rust code?

The asm! macro can now jump to a labeled Rust block, allowing inline assembly to transfer control back into safe Rust.

unsafe {
    asm!(
        "jmp {}",
        label {
            println!("Returned from assembly jump");
        }
    );
}

What does precise capturing in impl Trait enable for trait definitions?

It lets you specify exactly which generic types and lifetimes are captured by an impl Trait return type inside a trait, removing the need for hidden associated types.

trait Processor {
    fn process<'a>(&'a self) -> impl Sized + use;
}

In practice this desugars to an explicit associated type that does not depend on the method's lifetime parameters, making the API clearer for downstream crates.

What breaking change affects Windows 32-bit targets in Rust 1.87?

The i586-pc-windows-msvc target has been removed; projects must switch to i686-pc-windows-msvc because Windows 10 requires SSE2 support.

Frequently Asked Questions

Do I need to reinstall rustup to get Rust 1.87?
No, running rustup update stable will upgrade your existing installation to 1.87.

Can I still use unsafe blocks with the new safe architecture intrinsics?
Yes, you can keep unsafe blocks for other reasons, but the intrinsics themselves no longer require unsafe when the feature is enabled.

Is the std::io::pipe API stable across platforms?
The pipe API is stable and works on all major operating systems supported by Rust.

How do I write an asm! jump to a Rust block?
Use the label operand syntax: asm!("jmp {}", label { /* Rust code */ });

What command should I run to migrate from i586 to i686 Windows target?
Replace i586-pc-windows-msvc with i686-pc-windows-msvc in your Cargo target triple and rebuild.

Are the new const-stable APIs usable in const fn?
Yes, the APIs that were previously only usable at runtime are now allowed inside const contexts.

Releases In Branch 1.87

VersionRelease date
1.87.015 May 2025
(1 year ago)