← Back to all releases

Rust 1.2.0

Released on August 7, 2015

What's Changed

  • Patterns with ref mut now correctly invoke [DerefMut] when

  • The [Extend] trait, which grows a collection from an iterator, is
  • The [iter::once] function returns an iterator that yields a single
  • The [matches] and [rmatches] methods on str return iterators
  • [Cell] and [RefCell] both implement Eq.
  • A number of methods for wrapping arithmetic are added to the
  • The {:#?} formatting specifier [displays the alternate,
  • [fmt::Formatter] implements [fmt::Write], a fmt-specific trait
  • [fmt::Formatter] adds 'debug builder' methods, [debug_struct],
  • str has new [to_uppercase][strup] and [to_lowercase][strlow]
  • It is now easier to handle poisoned locks. The [PoisonError]
  • On Unix the [FromRawFd] trait is implemented for [Stdio], and
  • [io::ErrorKind] has a new variant, InvalidData, which indicates

  • The [to_uppercase] and [to_lowercase] methods on char now do
  • [mem::align_of] now specifies [the minimum alignment for
  • [The #[packed] attribute is no longer silently accepted by the
  • Associated type defaults are [now behind the

  • [Dynamically-sized-type coercions][dst] allow smart pointer types
  • [Parallel codegen][parcodegen] is now working again, which can
  • This is the first release with [experimental support for linking
  • Benchmark compilations are showing a 30% improvement in
  • rustc employs smarter heuristics for guessing at [typos].
  • rustc emits more efficient code for [no-op conversions between
  • Fat pointers are now [passed in pairs of immediate arguments][fat],
Full Changelog

* ~1200 changes, numerous bugfixes

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

----

* rustc employs smarter heuristics for guessing at [typos].

* rustc emits more efficient code for [no-op conversions between

unsafe pointers][nop].

* Fat pointers are now [passed in pairs of immediate arguments][fat],

resulting in faster compile times and smaller code.

[Extend]: https://doc.rust-lang.org/nightly/std/iter/trait.Extend.html

[extend-rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0839-embrace-extend-extinguish.md

[iter::once]: https://doc.rust-lang.org/nightly/std/iter/fn.once.html

[iter::empty]: https://doc.rust-lang.org/nightly/std/iter/fn.empty.html

[matches]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.matches

[rmatches]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.rmatches

[Cell]: https://doc.rust-lang.org/nightly/std/cell/struct.Cell.html

[RefCell]: https://doc.rust-lang.org/nightly/std/cell/struct.RefCell.html

[wrapping_add]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_add

[wrapping_sub]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_sub

[wrapping_mul]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_mul

[wrapping_div]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_div

[wrapping_rem]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_rem

[wrapping_neg]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_neg

[wrapping_shl]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_shl

[wrapping_shr]: https://doc.rust-lang.org/nightly/std/primitive.i8.html#method.wrapping_shr

[Wrapping]: https://doc.rust-lang.org/nightly/std/num/struct.Wrapping.html

[fmt::Formatter]: https://doc.rust-lang.org/nightly/std/fmt/struct.Formatter.html

[fmt::Write]: https://doc.rust-lang.org/nightly/std/fmt/trait.Write.html

[io::Write]: https://doc.rust-lang.org/nightly/std/io/trait.Write.html

[debug_struct]: https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html#method.debug_struct

[debug_tuple]: https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html#method.debug_tuple

[debug_list]: https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html#method.debug_list

[debug_set]: https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html#method.debug_set

[debug_map]: https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html#method.debug_map

[Debug]: https://doc.rust-lang.org/nightly/std/fmt/trait.Debug.html

[strup]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.to_uppercase

[strlow]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.to_lowercase

[to_uppercase]: https://doc.rust-lang.org/nightly/std/primitive.char.html#method.to_uppercase

[to_lowercase]: https://doc.rust-lang.org/nightly/std/primitive.char.html#method.to_lowercase

[PoisonError]: https://doc.rust-lang.org/nightly/std/sync/struct.PoisonError.html

[RwLock]: https://doc.rust-lang.org/nightly/std/sync/struct.RwLock.html

[Mutex]: https://doc.rust-lang.org/nightly/std/sync/struct.Mutex.html

[FromRawFd]: https://doc.rust-lang.org/nightly/std/os/unix/io/trait.FromRawFd.html

[AsRawFd]: https://doc.rust-lang.org/nightly/std/os/unix/io/trait.AsRawFd.html

[Stdio]: https://doc.rust-lang.org/nightly/std/process/struct.Stdio.html

[ChildStdin]: https://doc.rust-lang.org/nightly/std/process/struct.ChildStdin.html

[ChildStdout]: https://doc.rust-lang.org/nightly/std/process/struct.ChildStdout.html

[ChildStderr]: https://doc.rust-lang.org/nightly/std/process/struct.ChildStderr.html

[io::ErrorKind]: https://doc.rust-lang.org/nightly/std/io/enum.ErrorKind.html

[debugfmt]: https://www.reddit.com/r/rust/comments/3ceaui/psa_produces_prettyprinted_debug_output/

[DerefMut]: https://doc.rust-lang.org/nightly/std/ops/trait.DerefMut.html

[mem::align_of]: https://doc.rust-lang.org/nightly/std/mem/fn.align_of.html

[align]: https://github.com/rust-lang/rust/pull/25646

[mem::min_align_of]: https://doc.rust-lang.org/nightly/std/mem/fn.min_align_of.html

[typos]: https://github.com/rust-lang/rust/pull/26087

[nop]: https://github.com/rust-lang/rust/pull/26336

[fat]: https://github.com/rust-lang/rust/pull/26411

[dst]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md

[parcodegen]: https://github.com/rust-lang/rust/pull/26018

[packed]: https://github.com/rust-lang/rust/pull/25541

[ad]: https://github.com/rust-lang/rust/pull/27382

[win]: https://github.com/rust-lang/rust/pull/25350