Home

Software-update: Rust 1.94.0

Rust is een programmeertaal bedacht door Graydon Hoare en oorspronkelijk ontwikkeld door Mozilla. Het is deels geïnspireerd op de programmeertaal C, maar kent syntactische en semantische verschillen. Het focust op veiligheid en moet moderne computersystemen efficiënter benutten. Het wordt onder meer ingezet door Cloudflare, OVH, Mozilla, Deliveroo, Coursera, AppSignal en Threema. Versie 1.94 is uitgebracht en de releasenotes voor die uitgave kunnen hieronder worden gevonden.

Array windows

Rust 1.94 adds array_windows, an iterating method for slices. It works just like windows but with a constant length, so the iterator items are &[T; N] rather than dynamically-sized &[T]. In many cases, the window length may even be inferred by how the iterator is used! For example, part of one 2016 Advent of Code puzzle is looking for ABBA patterns: "two different characters followed by the reverse of that pair, such as xyyx or abba." If we assume only ASCII characters, that could be written by sweeping windows of the byte slice like this:

The destructuring argument pattern in that closure lets the compiler infer that we want windows of 4 here. If we had used the older .windows(4) iterator, then that argument would be a slice which we would have to index manually, hoping that runtime bounds-checking will be optimized away.

Cargo config inclusion

Cargo now supports the include key in configuration files (.cargo/config.toml), enabling better organization, sharing, and management of Cargo configurations across projects and environments. These include paths may also be marked optional if they might not be present in some circumstances, e.g. depending on local developer choices.

See the full include documentation for more details.

TOML 1.1 support in Cargo

Cargo now parses TOML v1.1 for manifests and configuration files. See the TOML release notes for detailed changes, including:

  • Inline tables across multiple lines and with trailing commas
  • \xHH and \e string escape characters
  • Optional seconds in times (sets to 0)
  • For example, a dependency like this:

    ... can now be written like this:

    Note that using these features in Cargo.toml will raise your development MSRV (minimum supported Rust version) to require this new Cargo parser, and third-party tools that read the manifest may also need to update their parsers. However, Cargo automatically rewrites manifests on publish to remain compatible with older parsers, so it is still possible to support an earlier MSRV for your crate's users.

    Stabilized APIs
  • <[T]>::array_windows
  • <[T]>::element_offset
  • LazyCell::get
  • LazyCell::get_mut
  • LazyCell::force_mut
  • LazyLock::get
  • LazyLock::get_mut
  • LazyLock::force_mut
  • impl TryFrom<char> for usize
  • std::iter::Peekable::next_if_map
  • std::iter::Peekable::next_if_map_mut
  • x86 avx512fp16 intrinsics (excluding those that depend directly on the unstable f16 type)
  • AArch64 NEON fp16 intrinsics (excluding those that depend directly on the unstable f16 type)
  • f32::consts::EULER_GAMMA
  • f64::consts::EULER_GAMMA
  • f32::consts::GOLDEN_RATIO
  • f64::consts::GOLDEN_RATIO
  • These previously stable APIs are now stable in const contexts:

  • f32::mul_add
  • f64::mul_add
  • Other changes

    Check out everything that changed in Rust, Cargo, and Clippy.

    Source: Tweakers.net

    Previous

    Next