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 windowsRust 1.94 adds
array_windows, an iterating method for slices. It works just likewindowsbut 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 asxyyxorabba." If we assume only ASCII characters, that could be written by sweeping windows of the byte slice like this:fn has_abba(s: &str) -> bool { s.as_bytes() .array_windows() .any(|[a1, b1, b2, a2]| (a1 != b1) && (a1 == a2) && (b1 == b2)) }The destructuring argument pattern in that closure lets the compiler infer that we want windows of 4 here. If we had used the older
Cargo config inclusion.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 now supports the
includekey 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 markedoptionalif they might not be present in some circumstances, e.g. depending on local developer choices.# array of paths include = [ "frodo.toml", "samwise.toml", ] # inline tables for more control include = [ { path = "required.toml" }, { path = "optional.toml", optional = true }, ]See the full
TOML 1.1 support in Cargoincludedocumentation for more details.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
\xHHand\estring escape characters- Optional seconds in times (sets to 0)
For example, a dependency like this:
serde = { version = "1.0", features = ["derive"] }... can now be written like this:
serde = { version = "1.0", features = ["derive"], }Note that using these features in
Stabilized APIsCargo.tomlwill 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.
<[T]>::array_windows<[T]>::element_offsetLazyCell::getLazyCell::get_mutLazyCell::force_mutLazyLock::getLazyLock::get_mutLazyLock::force_mutimpl TryFrom<char> for usizestd::iter::Peekable::next_if_mapstd::iter::Peekable::next_if_map_mut- x86
avx512fp16intrinsics (excluding those that depend directly on the unstablef16type)- AArch64 NEON fp16 intrinsics (excluding those that depend directly on the unstable
f16type)f32::consts::EULER_GAMMAf64::consts::EULER_GAMMAf32::consts::GOLDEN_RATIOf64::consts::GOLDEN_RATIOThese previously stable APIs are now stable in const contexts:
Other changesCheck out everything that changed in Rust, Cargo, and Clippy.
