Email me

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.

Aug 7, 2015release date
0language stabilizations
0APIs stabilized
-new edition

← 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 it

To 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 Rc to contain types without a fixed size, arrays and trait objects, finally enabling use of Rc<[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=N flag to rustc.
  • 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 on char now 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's alignof. [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_defaults feature 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 mut now 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, for String, Vec, LinkedList, VecDeque, EnumSet, BinaryHeap, VecMap, BTreeSet and BTreeMap. [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 on str return iterators over substring matches.
  • [Cell] and [RefCell] both implement Eq.
  • 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 the Debug formatter. This feature was actually introduced prior to 1.0 with little fanfare.
  • [fmt::Formatter] implements [fmt::Write], a fmt-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].
  • str has 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, exposes into_inner, get_ref, and get_mut, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. The is_poisoned method 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 the FromRawHandle trait is implemented for Stdio, and AsRawHandle for ChildStdin, ChildStdout, ChildStderr.
  • [io::ErrorKind] has a new variant, InvalidData, which indicates malformed input.

Misc

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

← Rust 1.1All versionsRust 1.3 →

Up next

Next releaseRust 1.3Released Sep 17, 2015.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