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 beoogt moderne computersystemen efficiënter te benutten. Het wordt ingezet door onder andere Cloudflare, OVH, Mozilla, Deliveroo, Coursera, AppSignal en Threema. Versie 1.80 is uitgebracht en de releasenotes voor die uitgave kunnen hieronder worden gevonden.
LazyCellandLazyLockThese "lazy" types delay the initialization of their data until first access. They are similar to the
OnceCellandOnceLocktypes stabilized in 1.70, but with the initialization function included in the cell. This completes the stabilization of functionality adopted into the standard library from the popularlazy_staticandonce_cellcrates.
LazyLockis the thread-safe option, making it suitable for places likestaticvalues. For example, both thespawnthread and the mainscopewill see the exact same duration below, sinceLAZY_TIMEwill be initialized once, by whichever ends up accessing the static first. Neither use has to know how to initialize it, unlike they would withOnceLock::get_or_init().Checked
LazyCelldoes the same thing without thread synchronization, so it doesn't implementSync, which is needed forstatic, but it can still be used inthread_local!statics (with distinct initialization per thread). Either type can also be used in other data structures as well, depending on thread-safety needs, so lazy initialization is available everywhere!cfgnames and valuesIn 1.79,
rustcstabilized a--check-cfgflag, and now Cargo 1.80 is enabling those checks for allcfgnames and values that it knows (in addition to the well known names and values fromrustc). This includes feature names fromCargo.tomlas well as newcargo::rustc-check-cfgoutput from build scripts.Unexpected cfgs are reported by the warn-by-default
unexpected_cfgslint, which is meant to catch typos or other misconfiguration. For example, in a project with an optionalrayondependency, this code is configured for the wrongfeaturevalue. The same warning is reported regardless of whether the actualrayonfeature is enabled or not.The
[lints]table in theCargo.tomlmanifest can also be used to extend the list of known names and values for customcfg.rustcautomatically provides the syntax to use in the warning.[lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(foo, values("bar"))'] }You can read more about this feature in a previous blog post announcing the availability of the feature on nightly.
Exclusive ranges in patternsRust ranged patterns can now use exclusive endpoints, written
a..bor..bsimilar to theRangeandRangeToexpression types. For example, the following patterns can now use the same constants for the end of one pattern and the start of the next:Previously, only inclusive (
a..=bor..=b) or open (a..) ranges were allowed in patterns, so code like this would require separate constants for inclusive endpoints likeK - 1.Exclusive ranges have been implemented as an unstable feature for a long time, but the blocking concern was that they might add confusion and increase the chance of off-by-one errors in patterns. To that end, exhaustiveness checking has been enhanced to better detect gaps in pattern matching, and new lints
Stabilized APIsnon_contiguous_range_endpointsandoverlapping_range_endpointswill help detect cases where you might want to switch exclusive patterns to inclusive, or vice versa.
impl Default for Rc<CStr>impl Default for Rc<str>impl Default for Rc<[T]>impl Default for Arc<str>impl Default for Arc<CStr>impl Default for Arc<[T]>impl IntoIterator for Box<[T]>impl FromIterator<String> for Box<str>impl FromIterator<char> for Box<str>LazyCellLazyLockDuration::div_duration_f32Duration::div_duration_f64Option::take_ifSeek::seek_relativeBinaryHeap::as_sliceNonNull::offsetNonNull::byte_offsetNonNull::addNonNull::byte_addNonNull::subNonNull::byte_subNonNull::offset_fromNonNull::byte_offset_fromNonNull::readNonNull::read_volatileNonNull::read_unalignedNonNull::writeNonNull::write_volatileNonNull::write_unalignedNonNull::write_bytesNonNull::copy_toNonNull::copy_to_nonoverlappingNonNull::copy_fromNonNull::copy_from_nonoverlappingNonNull::replaceNonNull::swapNonNull::drop_in_placeNonNull::align_offset<[T]>::split_at_checked<[T]>::split_at_mut_checkedstr::split_at_checkedstr::split_at_mut_checkedstr::trim_asciistr::trim_ascii_startstr::trim_ascii_end<[u8]>::trim_ascii<[u8]>::trim_ascii_start<[u8]>::trim_ascii_endIpv4Addr::BITSIpv4Addr::to_bitsIpv4Addr::from_bitsIpv6Addr::BITSIpv6Addr::to_bitsIpv6Addr::from_bitsVec::<[T; N]>::into_flattened<[[T; N]]>::as_flattened<[[T; N]]>::as_flattened_mutThese APIs are now stable in const contexts:
Other changesCheck out everything that changed in Rust, Cargo, and Clippy.
