Email me

Rust versions / 1.48

Rust release · Nov 19, 2020

Rust 1.48: what's new, what was stabilized

Short answerRust 1.48 was released on Nov 19, 2020: 13 newly stable APIs (slice::as_ptr_range, slice::as_mut_ptr_range, VecDeque::make_contiguous, future::pending, ...); 10 compatibility notes that can affect existing code.

Nov 19, 2020release date
0language stabilizations
13APIs stabilized
-new edition

← Rust 1.47All versionsRust 1.49 →

13 APIs stabilized

slice::as_ptr_range, slice::as_mut_ptr_range, VecDeque::make_contiguous, future::pending, future::ready, Option::is_some, Option::is_none, Option::as_ref, Result::is_ok, Result::is_err, Result::as_ref, Ordering::reverse, Ordering::then

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:

  • [Promotion of references to 'static lifetime inside const fn now follows the
  • [Associated type bindings on trait objects are now verified to meet the bounds
  • [When trait bounds on associated types or opaque types are ambiguous, the
  • [Fixed recursive nonterminals not being expanded in macros during
  • [&mut references to non zero-sized types are no longer promoted.][75585]
  • [rustc will now warn if you use attributes like #[link_name] or #[cold]
  • [Updated _mm256_extract_epi8 and _mm256_extract_epi16 signatures in
  • [mem::uninitialized will now panic if any inner types inside a struct or enum
  • [#[target_feature] will now error if used in a place where it has no effect.][78143]
  • [Foreign exceptions are now caught by catch_unwind and will cause an abort.][70212]

Use it

rustup update stable        # get the newest release
rustup install 1.48          # or exactly this one
rustup override set 1.48     # pin a project to it

To require at least this version from users of your crate, set rust-version = "1.48" 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

  • [The unsafe keyword is now syntactically permitted on modules.][75857] This is still rejected *semantically*, but can now be parsed by procedural macros.

Compiler

  • [Stabilised the -C link-self-contained=<yes|no> compiler flag.][76158] This tells rustc whether to link its own C runtime and libraries or to rely on a external linker to find them. (Supported only on windows-gnu, linux-musl, and wasi platforms.)
  • [You can now use -C target-feature=+crt-static on linux-gnu targets.][77386] Note: If you're using cargo you must explicitly pass the --target flag.
  • [Added tier 2\* support for aarch64-unknown-linux-musl.][76420]

\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

  • [io::Write is now implemented for &ChildStdin &Sink, &Stdout, and &Stderr.][76275]
  • [All arrays of any length now implement TryFrom<Vec<T>>.][76310]
  • [The matches! macro now supports having a trailing comma.][74880]
  • [Vec<A> now implements PartialEq<[B]> where A: PartialEq<B>.][74194]
  • [The RefCell::{replace, replace_with, clone} methods now all use #[track_caller].][77055]

Stabilized APIs

  • [slice::as_ptr_range]
  • [slice::as_mut_ptr_range]
  • [VecDeque::make_contiguous]
  • [future::pending]
  • [future::ready]

The following previously stable methods are now const fn's:

  • [Option::is_some]
  • [Option::is_none]
  • [Option::as_ref]
  • [Result::is_ok]
  • [Result::is_err]
  • [Result::as_ref]
  • [Ordering::reverse]
  • [Ordering::then]

Rustdoc

  • [You can now link to items in rustdoc using the intra-doc link syntax.][74430] E.g. `/// Uses [std::future] will automatically generate a link to std::future`'s documentation. See ["Linking to items by name"][intradoc-links] for more information.
  • [You can now specify #[doc(alias = "<alias>")] on items to add search aliases when searching through rustdoc's UI.][75740]

Compatibility Notes

  • [Promotion of references to 'static lifetime inside const fn now follows the same rules as inside a fn body.][75502] In particular, &foo() will not be promoted to 'static lifetime any more inside const fns.
  • [Associated type bindings on trait objects are now verified to meet the bounds declared on the trait when checking that they implement the trait.][27675]
  • [When trait bounds on associated types or opaque types are ambiguous, the compiler no longer makes an arbitrary choice on which bound to use.][54121]
  • [Fixed recursive nonterminals not being expanded in macros during pretty-print/reparse check.][77153] This may cause errors if your macro wasn't correctly handling recursive nonterminal tokens.
  • [&mut references to non zero-sized types are no longer promoted.][75585]
  • [rustc will now warn if you use attributes like #[link_name] or #[cold] in places where they have no effect.][73461]
  • [Updated _mm256_extract_epi8 and _mm256_extract_epi16 signatures in arch::{x86, x86_64} to return i32 to match the vendor signatures.][73166]
  • [mem::uninitialized will now panic if any inner types inside a struct or enum disallow zero-initialization.][71274]
  • [#[target_feature] will now error if used in a place where it has no effect.][78143]
  • [Foreign exceptions are now caught by catch_unwind and will cause an abort.][70212] Note: This behaviour is not guaranteed and is still considered undefined behaviour, see the [catch_unwind] documentation for further information.

Internal Only

These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.

Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.

← Rust 1.47All versionsRust 1.49 →

Up next

Next releaseRust 1.49Released Dec 31, 2020.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ