Rust versions / 1.26
Rust release · May 10, 2018
Rust 1.26: what's new, what was stabilized
Short answerRust 1.26 was released on May 10, 2018: 40 newly stable APIs (*const T::add, *const T::copy_to_nonoverlapping, *const T::copy_to, *const T::read_unaligned, ...); 6 compatibility notes that can affect existing code. Point releases: 1.26.1 (May 29, 2018), 1.26.2 (Jun 5, 2018).
← Rust 1.25All versionsRust 1.27 →
40 APIs stabilized
*const T::add, *const T::copy_to_nonoverlapping, *const T::copy_to, *const T::read_unaligned, *const T::read_volatile, *const T::read, *const T::sub, *const T::wrapping_add, *const T::wrapping_sub, *mut T::add, *mut T::copy_to_nonoverlapping, *mut T::copy_to, *mut T::read_unaligned, *mut T::read_volatile, *mut T::read, *mut T::replace, *mut T::sub, *mut T::swap, *mut T::wrapping_add, *mut T::wrapping_sub, *mut T::write_bytes, *mut T::write_unaligned, *mut T::write_volatile, *mut T::write, Box::leak, FromUtf8Error::as_bytes, LocalKey::try_with, Option::cloned, btree_map::Entry::and_modify, fs::read_to_string, fs::read, fs::write, hash_map::Entry::and_modify, iter::FusedIterator, ops::RangeInclusive, ops::RangeToInclusive, process::id, slice::rotate_left, slice::rotate_right, String::retain
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- [aliasing a
Fntrait asdynno longer works.][48481] E.g. the following - [The result of dereferences are no longer promoted to
'static.][47408] - [Deprecate
AsciiExttrait in favor of inherent methods.][49109] - [
".e0"will now no longer parse as0.0and will instead cause - [Removed hoedown from rustdoc.][48274]
- [Bounds on higher-kinded lifetimes a hard error.][48326]
Use it
rustup update stable # get the newest release
rustup install 1.26 # or exactly this one
rustup override set 1.26 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.26" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- [Closures now implement
Copyand/orCloneif all captured variables implement either or both traits.][49299] - [The inclusive range syntax e.g.
for x in 0..=10is now stable.][47813] - [The
'_lifetime is now stable. The underscore lifetime can be used anywhere a lifetime can be elided.][49458] - [
impl Traitis now stable allowing you to have abstract types in returns or in function parameters.][49255] E.g.fn foo() -> impl Iterator<Item=u8>orfn open(path: impl AsRef<Path>). - [Pattern matching will now automatically apply dereferences.][49394]
- [128-bit integers in the form of
u128andi128are now stable.][49101] - [
maincan now returnResult<(), E: Debug>][49162] in addition to(). - [A lot of operations are now available in a const context.][46882] E.g. You can now index into constant arrays, reference and dereference into constants, and use tuple struct constructors.
- [Fixed entry slice patterns are now stable.][48516] E.g. ``
rust let points = [1, 2, 3, 4]; match points { [1, 2, 3, 4] => println!("All points were sequential."), _ => println!("Not all points were sequential."), }``
Compiler
- [LLD is now used as the default linker for
wasm32-unknown-unknown.][48125] - [Fixed exponential projection complexity on nested types.][48296] This can provide up to a ~12% reduction in compile times for certain crates.
- [Added the
--remap-path-prefixoption to rustc.][48359] Allowing you to remap path prefixes outputted by the compiler. - [Added
powerpc-unknown-netbsdtarget.][48281]
Libraries
- [Implemented
From<u16> for usize&From<{u8, i16}> for isize.][49305] - [Added hexadecimal formatting for integers with fmt::Debug][48978] e.g.
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]") - [Implemented
Default, Hashforcmp::Reverse.][48628] - [Optimized
str::repeatbeing 8x faster in large cases.][48657] - [
ascii::escape_defaultis now available in libcore.][48735] - [Trailing commas are now supported in std and core macros.][48056]
- [Implemented
Copy, Cloneforcmp::Reverse][47379] - [Implemented
Cloneforchar::{ToLowercase, ToUppercase}.][48629]
Stabilized APIs
- [
*const T::add] - [
*const T::copy_to_nonoverlapping] - [
*const T::copy_to] - [
*const T::read_unaligned] - [
*const T::read_volatile] - [
*const T::read] - [
*const T::sub] - [
*const T::wrapping_add] - [
*const T::wrapping_sub] - [
*mut T::add] - [
*mut T::copy_to_nonoverlapping] - [
*mut T::copy_to] - [
*mut T::read_unaligned] - [
*mut T::read_volatile] - [
*mut T::read] - [
*mut T::replace] - [
*mut T::sub] - [
*mut T::swap] - [
*mut T::wrapping_add] - [
*mut T::wrapping_sub] - [
*mut T::write_bytes] - [
*mut T::write_unaligned] - [
*mut T::write_volatile] - [
*mut T::write] - [
Box::leak] - [
FromUtf8Error::as_bytes] - [
LocalKey::try_with] - [
Option::cloned] - [
btree_map::Entry::and_modify] - [
fs::read_to_string] - [
fs::read] - [
fs::write] - [
hash_map::Entry::and_modify] - [
iter::FusedIterator] - [
ops::RangeInclusive] - [
ops::RangeToInclusive] - [
process::id] - [
slice::rotate_left] - [
slice::rotate_right] - [
String::retain]
Cargo
- [Cargo will now output path to custom commands when
-vis passed with--list][cargo/5041] - [The Cargo binary version is now the same as the Rust version][cargo/5083]
Misc
- [The second edition of "The Rust Programming Language" book is now recommended over the first.][48404]
Compatibility Notes
- aliasing a
Fntrait asdynno longer works. E.g. the following syntax is now invalid. ``use std::ops::Fn as dyn; fn g(_: Box<dyn(std::fmt::Debug)>) {}`` - The result of dereferences are no longer promoted to
'static. e.g. ``rust fn main() { const PAIR: &(i32, i32) = &(0, 1); let _reversed_pair: &'static _ = &(PAIR.1, PAIR.0); // Doesn't work }`` - Deprecate
AsciiExttrait in favor of inherent methods. ".e0"will now no longer parse as0.0and will instead cause an error.- Removed hoedown from rustdoc.
- Bounds on higher-kinded lifetimes a hard error.
1.26.1 (May 29, 2018)
Tools -----
Compatibility Notes --------
fn main() -> impl Traitno longer works for non-Termination trait. This reverts an accidental stabilization.NaN > NaNno longer returns true in const-fn contexts.- Prohibit using turbofish for
impl Traitin method arguments.
1.26.2 (Jun 5, 2018)
Compatibility Notes -------------------
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.27Released Jun 21, 2018.Read it next →Also worth your time
Did this answer your question?