Email me

Rust versions / 1.33

Rust release · Feb 28, 2019

Rust 1.33: what's new, what was stabilized

Short answerRust 1.33 was released on Feb 28, 2019: 13 newly stable APIs (unix::FileExt::read_exact_at, unix::FileExt::write_all_at, Option::transpose, Result::transpose, ...); 3 compatibility notes that can affect existing code.

Feb 28, 2019release date
0language stabilizations
13APIs stabilized
-new edition

← Rust 1.32All versionsRust 1.34 →

13 APIs stabilized

unix::FileExt::read_exact_at, unix::FileExt::write_all_at, Option::transpose, Result::transpose, convert::identity, pin::Pin, marker::Unpin, marker::PhantomPinned, Vec::resize_with, VecDeque::resize_with, Duration::as_millis, Duration::as_micros, Duration::as_nanos

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:

  • The methods str::{trim_left, trim_right, trim_left_matches, trim_right_matches}
  • The Error::cause method has been deprecated in favor of Error::source which supports
  • [Libtest no longer creates a new thread for each test when

Use it

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

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

  • [You can now use the cfg(target_vendor) attribute.][57465] E.g. #[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }
  • [Integer patterns such as in a match expression can now be exhaustive.][56362] E.g. You can have match statement on a u8 that covers 0..=255 and you would no longer be required to have a _ => unreachable!() case.
  • [You can now have multiple patterns in if let and while let expressions.][57532] You can do this with the same syntax as a match expression. E.g. ```rust enum Creature { Crab(String), Lobster(String), Person(String), }

fn main() { let state = Creature::Crab("Ferris");

if let Creature::Crab(name) | Creature::Person(name) = state { println!("This creature's name is: {}", name); } } ```

  • [You can now have irrefutable if let and while let patterns.][57535] Using this feature will by default produce a warning as this behaviour can be unintuitive. E.g. if let _ = 5 {}
  • [You can now use let bindings, assignments, expression statements, and irrefutable pattern destructuring in const functions.][57175]
  • [You can now call unsafe const functions.][57067] E.g. ``rust const unsafe fn foo() -> i32 { 5 } const fn bar() -> i32 { unsafe { foo() } } ``
  • [You can now specify multiple attributes in a cfg_attr attribute.][57332] E.g. #[cfg_attr(all(), must_use, optimize)]
  • [You can now specify a specific alignment with the #[repr(packed)] attribute.][57049] E.g. #[repr(packed(2))] struct Foo(i16, i32); is a struct with an alignment of 2 bytes and a size of 6 bytes.
  • [You can now import an item from a module as an _.][56303] This allows you to import a trait's impls, and not have the name in the namespace. E.g. ```rust use std::io::Read as _;

// Allowed as there is only one Read in the module. pub trait Read {} ```

  • [You may now use Rc, Arc, and Pin as method receivers][56805].

Compiler

  • [You can now set a linker flavor for rustc with the -Clinker-flavor command line argument.][56351]
  • [The minimum required LLVM version has been bumped to 6.0.][56642]
  • [Added support for the PowerPC64 architecture on FreeBSD.][57615]
  • [The x86_64-fortanix-unknown-sgx target support has been upgraded to tier 2 support.][57130] Visit the [platform support][platform-support] page for information on Rust's platform support.
  • [Added support for the thumbv7neon-linux-androideabi and thumbv7neon-unknown-linux-gnueabihf targets.][56947]
  • [Added support for the x86_64-unknown-uefi target.][56769]

Libraries

  • [The methods overflowing_{add, sub, mul, shl, shr} are now const functions for all numeric types.][57566]
  • [The methods rotate_left, rotate_right, and wrapping_{add, sub, mul, shl, shr} are now const functions for all numeric types.][57105]
  • [The methods is_positive and is_negative are now const functions for all signed numeric types.][57105]
  • [The get method for all NonZero types is now const.][57167]
  • [The methods count_ones, count_zeros, leading_zeros, trailing_zeros, swap_bytes, from_be, from_le, to_be, to_le are now const for all numeric types.][57234]
  • [Ipv4Addr::new is now a const function][57234]

Stabilized APIs

  • [unix::FileExt::read_exact_at]
  • [unix::FileExt::write_all_at]
  • [Option::transpose]
  • [Result::transpose]
  • [convert::identity]
  • [pin::Pin]
  • [marker::Unpin]
  • [marker::PhantomPinned]
  • [Vec::resize_with]
  • [VecDeque::resize_with]
  • [Duration::as_millis]
  • [Duration::as_micros]
  • [Duration::as_nanos]

Cargo

  • [You can now publish crates that require a feature flag to compile with cargo publish --features or cargo publish --all-features.][cargo/6453]
  • [Cargo should now rebuild a crate if a file was modified during the initial build.][cargo/6484]

Compatibility Notes

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

← Rust 1.32All versionsRust 1.34 →

Up next

Next releaseRust 1.34Released Apr 11, 2019.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