Rust 1.75 and 1.76: Improvements Noticeable Daily

Engranajes metálicos oxidados entrelazados representando industria sólida

Rust 1.75 (Dec 2023) and Rust 1.76 (Feb 2024) brought incremental but notable improvements. Highlights: stabilised async fn in traits, improved return position impl Trait, pointer_bytes, debug info enhancements. This article covers what matters for productive developers.

Rust 1.75: async fn in traits

Long-awaited:

trait AsyncDatabase {
    async fn query(&self, sql: &str) -> Result<Data>;
}

impl AsyncDatabase for Postgres {
    async fn query(&self, sql: &str) -> Result<Data> {
        // impl
    }
}

Previously needed async-trait crate. Now native.

Return Position impl Trait in Traits

Combined:

trait Container {
    fn iter(&self) -> impl Iterator<Item = i32>;
}

Before required workarounds. Clean now.

1.76: Pointer Types

Better byte handling:

let ptr: *const u8 = ...;
let addr = ptr as usize; // before
let bytes = ptr.byte_add(4); // more expressive now

Safety improvements in pointer arithmetic.

Debug Info Improvements

  • Better inlining debug: more accurate backtraces.
  • Types in debug: tools show more info.
  • Async stack traces improved.

Notably better debugging experience.

Compile Times

Incremental improvements each release. 1.75 → 1.76:

  • Simple projects: 2-3% faster.
  • Large projects: typically 5-10% faster.
  • Proc macros: varying.

Incrementals accumulate.

Ecosystem

Crates adapting:

  • tokio: async fn in traits adoption.
  • axum: cleaner trait signatures.
  • async-trait usage declining (native replacement).
  • async libraries: simpler APIs.

Stabilisations

Recent stabilisations:

  • Ipv4Addr::BITS constants.
  • Result::map_err improvements.
  • Various unsafe function improvements.

Continuous language polish.

For Productive Developers

Changes mattering day-to-day:

  • Cleaner async trait code.
  • Better error messages each release.
  • Accumulated faster builds.
  • More stable each version.

Upgrade cost: minimal. Benefit: real.

Edition Changes

Rust 2024 edition in preparation (stabilised in Rust 1.85, Feb 2025). Planned changes:

  • Better if let ergonomics.
  • Reserved keywords.
  • unsafe attribute requirements.

1.75/1.76 incremental prep.

Compatibility

Backwards-compatible (Rust guarantees):

  • 1.0 code compiles.
  • Editions for breaking changes (opt-in).
  • Stable features remain stable.

Upgrade any time safe.

Ecosystem Crate Updates

For common libraries:

  • serde: continuous.
  • tokio: async fn trait adoption.
  • reqwest: minor.
  • clap: refinements.
  • anyhow / thiserror: stable.

Updates typically non-breaking.

Productivity Features

Small quality-of-life:

  • let-else: cleaner error handling.
  • expanded cfg: better conditional compile.
  • #[diagnostic]: better error messages from crates.

Accumulate significantly over versions.

Industry Impact

Rust adoption continuing:

  • Linux kernel: progress (covered separately).
  • Microsoft: rewriting components in Rust.
  • Google: Android components.
  • Cloudflare, Discord, Figma: production use.
  • AWS: Bottlerocket, Firecracker.

Stable growth.

Conclusion

Rust 1.75/1.76 are low-drama, high-quality-of-life releases. async fn in traits eliminated major friction. Incrementally better performance and debug info. For productive Rust teams, same-month upgrade without risk. Changes accumulate: Rust every 6 months is perceptibly better than previous. Stability + evolution balance characterising Rust maturity.

Follow us on jacar.es for more on Rust, systems programming, and language evolution.

Entradas relacionadas