Email me

Rust versions / 1.5

Rust release · Dec 10, 2015

Rust 1.5: what's new, what was stabilized

Short answerRust 1.5 was released on Dec 10, 2015.

Dec 10, 2015release date
0language stabilizations
0APIs stabilized
-new edition

← Rust 1.4All versionsRust 1.6 →

Can it break my build?

No compatibility notes were listed for this release.

Use it

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

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

Highlights

  • Stabilized APIs: [BinaryHeap::from], [BinaryHeap::into_sorted_vec], [BinaryHeap::into_vec], [Condvar::wait_timeout], [FileTypeExt::is_block_device], [FileTypeExt::is_char_device], [FileTypeExt::is_fifo], [FileTypeExt::is_socket], [FileTypeExt], [Formatter::alternate], [Formatter::fill], [Formatter::precision], [Formatter::sign_aware_zero_pad], [Formatter::sign_minus], [Formatter::sign_plus], [Formatter::width], [Iterator::cmp], [Iterator::eq], [Iterator::ge], [Iterator::gt], [Iterator::le], [Iterator::lt], [Iterator::ne], [Iterator::partial_cmp], [Path::canonicalize], [Path::exists], [Path::is_dir], [Path::is_file], [Path::metadata], [Path::read_dir], [Path::read_link], [Path::symlink_metadata], [Utf8Error::valid_up_to], [Vec::resize], [VecDeque::as_mut_slices], [VecDeque::as_slices], [VecDeque::insert], [VecDeque::shrink_to_fit], [VecDeque::swap_remove_back], [VecDeque::swap_remove_front], [slice::split_first_mut], [slice::split_first], [slice::split_last_mut], [slice::split_last], [char::from_u32_unchecked], [fs::canonicalize], [str::MatchIndices], [str::RMatchIndices], [str::match_indices], [str::rmatch_indices], [str::slice_mut_unchecked], [string::ParseError].
  • Rust applications hosted on crates.io can be installed locally to ~/.cargo/bin with the [cargo install] command. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g. cargo-foo is found in $PATH it can be invoked as cargo foo.
  • Crates with wildcard (*) dependencies will [emit warnings when published][1.5w]. In 1.6 it will no longer be possible to publish crates with wildcard dependencies.

Breaking Changes

  • The rules determining when a particular lifetime must outlive a particular value (known as '[dropck]') have been [modified to not rely on parametricity][1.5p].
  • [Implementations of AsRef and AsMut were added to Box, Rc, and Arc][1.5a]. Because these smart pointer types implement Deref, this causes breakage in cases where the interior type contains methods of the same name.
  • [Correct a bug in Rc/Arc][1.5c] that caused [dropck] to be unaware that they could drop their content. Soundness fix.
  • All method invocations are [properly checked][1.5wf1] for [well-formedness][1.5wf2]. Soundness fix.
  • Traits whose supertraits contain Self are [not object safe][1.5o]. Soundness fix.
  • Target specifications support a [no_default_libraries][1.5nd] setting that controls whether -nodefaultlibs is passed to the linker, and in turn the is_like_windows setting no longer affects the -nodefaultlibs flag.
  • #[derive(Show)], long-deprecated, [has been removed][1.5ds].
  • The #[inline] and #[repr] attributes [can only appear in valid locations][1.5at].
  • Native libraries linked from the local crate are [passed to the linker before native libraries from upstream crates][1.5nl].
  • Two rarely-used attributes, #[no_debug] and #[omit_gdb_pretty_printer_section] [are feature gated][1.5fg].
  • Negation of unsigned integers, which has been a warning for several releases, [is now behind a feature gate and will generate errors][1.5nu].
  • The parser accidentally accepted visibility modifiers on enum variants, a bug [which has been fixed][1.5ev].
  • [A bug was fixed that allowed use statements to import unstable features][1.5use].

Language

  • When evaluating expressions at compile-time that are not compile-time constants (const-evaluating expressions in non-const contexts), incorrect code such as overlong bitshifts and arithmetic overflow will [generate a warning instead of an error][1.5ce], delaying the error until runtime. This will allow the const-evaluator to be expanded in the future backwards-compatibly.
  • The improper_ctypes lint [no longer warns about using isize and usize in FFI][1.5ict].

Libraries

  • Arc<T> and Rc<T> are [covariant with respect to T instead of invariant][1.5c].
  • Default is [implemented for mutable slices][1.5d].
  • FromStr is [implemented for SockAddrV4 and SockAddrV6][1.5s].
  • There are now From conversions [between floating point types][1.5f] where the conversions are lossless.
  • There are now From conversions [between integer types][1.5i] where the conversions are lossless.
  • [fs::Metadata implements Clone][1.5fs].
  • The parse method [accepts a leading "+" when parsing integers][1.5pi].
  • [AsMut is implemented for Vec][1.5am].
  • The clone_from implementations for String and BinaryHeap [have been optimized][1.5cf] and no longer rely on the default impl.
  • The extern "Rust", extern "C", unsafe extern "Rust" and unsafe extern "C" function types now [implement Clone, PartialEq, Eq, PartialOrd, Ord, Hash, fmt::Pointer, and fmt::Debug for up to 12 arguments][1.5fp].
  • [Dropping Vecs is much faster in unoptimized builds when the element types don't implement Drop][1.5dv].
  • A bug that caused in incorrect behavior when [combining VecDeque with zero-sized types][1.5vdz] was resolved.
  • [PartialOrd for slices is faster][1.5po].

Miscellaneous

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

← Rust 1.4All versionsRust 1.6 →

Up next

Next releaseRust 1.6Released Jan 21, 2016.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