Email me

Rust versions / 1.18

Rust release · Jun 8, 2017

Rust 1.18: what's new, what was stabilized

Short answerRust 1.18 was released on Jun 8, 2017: 2 language stabilizations ([Stabilize pub(restricted)][40556] pub can now accept a module path to); 7 newly stable APIs (Child::try_wait, HashMap::retain, HashSet::retain, PeekMut::pop, ...); 8 compatibility notes that can affect existing code.

Jun 8, 2017release date
2language stabilizations
7APIs stabilized
-new edition

← Rust 1.17All versionsRust 1.19 →

Language features stabilized

  • [Stabilize pub(restricted)][40556] pub can now accept a module path to
  • [Stabilize #![windows_subsystem] attribute][40870] conservative exposure of the

7 APIs stabilized

Child::try_wait, HashMap::retain, HashSet::retain, PeekMut::pop, TcpStream::peek, UdpSocket::peek, UdpSocket::peek_from

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:

  • [Changes to how the 0 flag works in format!][40241] Padding zeroes are now
  • [Due to the struct field optimisation][40377], using transmute on structs
  • [The refactor of trait object type parsing][40043] fixed a bug where + was
  • [Overlapping inherent impls are now a hard error][40728]
  • [PartialOrd and Ord must agree on the ordering.][41270]
  • [rustc main.rs -o out --emit=asm,llvm-ir][41085] Now will output
  • [ calling a function that returns Self will no longer work][41805] when
  • [rustc now builds with a "pthreads" flavour of MinGW for Windows GNU][40805]

Use it

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

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

  • [Stabilize pub(restricted)][40556] pub can now accept a module path to make the item visible to just that module tree. Also accepts the keyword crate to make something public to the whole crate but not users of the library. Example: pub(crate) mod utils;. [RFC 1422].
  • [Stabilize #![windows_subsystem] attribute][40870] conservative exposure of the /SUBSYSTEM linker flag on Windows platforms. [RFC 1665].
  • [Refactor of trait object type parsing][40043] Now ty in macros can accept types like Write + Send, trailing + are now supported in trait objects, and better error reporting for trait objects starting with ?Sized.
  • [0e+10 is now a valid floating point literal][40589]
  • [Now warns if you bind a lifetime parameter to 'static][40734]
  • [Tuples, Enum variant fields, and structs with no repr attribute or with #[repr(Rust)] are reordered to minimize padding and produce a smaller representation in some cases.][40377]

Compiler

  • [rustc can now emit mir with --emit mir][39891]
  • [Improved LLVM IR for trivial functions][40367]
  • [Added explanation for E0090(Wrong number of lifetimes are supplied)][40723]
  • [rustc compilation is now 15%-20% faster][41469] Thanks to optimisation opportunities found through profiling
  • [Improved backtrace formatting when panicking][38165]

Libraries

  • [Specialized Vec::from_iter being passed vec::IntoIter][40731] if the iterator hasn't been advanced the original Vec is reassembled with no actual iteration or reallocation.
  • [Simplified HashMap Bucket interface][40561] provides performance improvements for iterating and cloning.
  • [Specialize Vec::from_elem to use calloc][40409]
  • [Fixed Race condition in fs::create_dir_all][39799]
  • [No longer caching stdio on Windows][40516]
  • [Optimized insertion sort in slice][40807] insertion sort in some cases 2.50%~ faster and in one case now 12.50% faster.
  • [Optimized AtomicBool::fetch_nand][41143]

Stabilized APIs

  • [Child::try_wait]
  • [HashMap::retain]
  • [HashSet::retain]
  • [PeekMut::pop]
  • [TcpStream::peek]
  • [UdpSocket::peek]
  • [UdpSocket::peek_from]

Cargo

  • [Added partial Pijul support][cargo/3842] Pijul is a version control system in Rust. You can now create new cargo projects with Pijul using cargo new --vcs pijul
  • [Now always emits build script warnings for crates that fail to build][cargo/3847]
  • [Added Android build support][cargo/3885]
  • [Added --bins and --tests flags][cargo/3901] now you can build all programs of a certain type, for example cargo build --bins will build all binaries.
  • [Added support for haiku][cargo/3952]

Misc

  • [rustdoc can now use pulldown-cmark with the --enable-commonmark flag][40338]
  • [Rust now uses the official cross compiler for NetBSD][40612]
  • [rustdoc now accepts # at the start of files][40828]
  • [Fixed jemalloc support for musl][41168]

Compatibility Notes

  • Changed the link order of local static/dynamic libraries (respecting the order on given rather than having the compiler reorder).
  • Changed how MinGW is linked, native code linked to dynamic libraries may require manually linking to the gcc support library (for the native code itself)

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

← Rust 1.17All versionsRust 1.19 →

Up next

Next releaseRust 1.19Released Jul 20, 2017.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