Rust versions / 1.2
Rust release · Aug 7, 2015
Rust 1.2: what's new, what was stabilized
Short answerRust 1.2 was released on Aug 7, 2015.
← Rust 1.1All versionsRust 1.3 →
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.2 # or exactly this one
rustup override set 1.2 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.2" 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
- [Dynamically-sized-type coercions][dst] allow smart pointer types like
Rcto contain types without a fixed size, arrays and trait objects, finally enabling use ofRc<[T]>and completing the implementation of DST. - [Parallel codegen][parcodegen] is now working again, which can substantially speed up large builds in debug mode; It also gets another ~33% speedup when bootstrapping on a 4 core machine (using 8 jobs). It's not enabled by default, but will be "in the near future". It can be activated with the
-C codegen-units=Nflag torustc. - This is the first release with [experimental support for linking with the MSVC linker and lib C on Windows (instead of using the GNU variants via MinGW)][win]. It is yet recommended only for the most intrepid Rustaceans.
- Benchmark compilations are showing a 30% improvement in bootstrapping over 1.1.
Breaking Changes
- The [
to_uppercase] and [to_lowercase] methods oncharnow do unicode case mapping, which is a previously-planned change in behavior and considered a bugfix. - [
mem::align_of] now specifies [the *minimum alignment* for T][align], which is usually the alignment programs are interested in, and the same value reported by clang'salignof. [mem::min_align_of] is deprecated. This is not known to break real code. - [The
#[packed]attribute is no longer silently accepted by the compiler][packed]. This attribute did nothing and code that mentioned it likely did not work as intended. - Associated type defaults are [now behind the
associated_type_defaultsfeature gate][ad]. In 1.1 associated type defaults *did not work*, but could be mentioned syntactically. As such this breakage has minimal impact.
Language
- Patterns with
ref mutnow correctly invoke [DerefMut] when matching against dereferenceable values.
Libraries
- The [
Extend] trait, which grows a collection from an iterator, is implemented over iterators of references, forString,Vec,LinkedList,VecDeque,EnumSet,BinaryHeap,VecMap,BTreeSetandBTreeMap. [RFC][extend-rfc]. - The [
iter::once] function returns an iterator that yields a single element, and [iter::empty] returns an iterator that yields no elements. - The [
matches] and [rmatches] methods onstrreturn iterators over substring matches. - [
Cell] and [RefCell] both implementEq. - A number of methods for wrapping arithmetic are added to the integral types, [
wrapping_div], [wrapping_rem], [wrapping_neg], [wrapping_shl], [wrapping_shr]. These are in addition to the existing [wrapping_add], [wrapping_sub], and [wrapping_mul] methods, and alternatives to the [Wrapping] type.. It is illegal for the default arithmetic operations in Rust to overflow; the desire to wrap must be explicit. - The
{:#?}formatting specifier [displays the alternate, pretty-printed][debugfmt] form of theDebugformatter. This feature was actually introduced prior to 1.0 with little fanfare. - [
fmt::Formatter] implements [fmt::Write], afmt-specific trait for writing data to formatted strings, similar to [io::Write]. - [
fmt::Formatter] adds 'debug builder' methods, [debug_struct], [debug_tuple], [debug_list], [debug_set], [debug_map]. These are used by code generators to emit implementations of [Debug]. strhas new [to_uppercase][strup] and [to_lowercase][strlow] methods that convert case, following Unicode case mapping.- It is now easier to handle poisoned locks. The [
PoisonError] type, returned by failing lock operations, exposesinto_inner,get_ref, andget_mut, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. Theis_poisonedmethod of [RwLock] and [Mutex] can poll for a poisoned lock without attempting to take the lock. - On Unix the [
FromRawFd] trait is implemented for [Stdio], and [AsRawFd] for [ChildStdin], [ChildStdout], [ChildStderr]. On Windows theFromRawHandletrait is implemented forStdio, andAsRawHandleforChildStdin,ChildStdout,ChildStderr. - [
io::ErrorKind] has a new variant,InvalidData, which indicates malformed input.
Misc
rustcemploys smarter heuristics for guessing at typos.rustcemits more efficient code for no-op conversions between unsafe pointers.- Fat pointers are now passed in pairs of immediate arguments, resulting in faster compile times and smaller code.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.3Released Sep 17, 2015.Read it next →Also worth your time
Did this answer your question?