Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rust 1.3 Brings Stabilisation for APIs

Rust 1.3 Brings Stabilisation for APIs

The Rust core team has released 1.3 stable, bringing with it API stabilisation and further work on the language's performance.

In the blog post "Announcing Rust 1.3," the team said Rust had seen with this release a large amount of stabilisation "including the new Duration API and enhancements to Error and Hash/Hasher," and that further growth of the std::time module was expected "in the 1.5 timeframe."

Rust contributor Steven Fackler, responsible for commit 26818 to stabilise Duration, said it stabilised both the std::time module and the Duration type. Fackler noted that Duration::span remained unstable, and that the Display implementation for Duration has been removed because "it is still being reworked and all trait implementations for stable types are de facto stable."

Fackler points out this commit is a breaking-change for anyone using Duration's Display implementation.

Following the release of version 1.0, unveiled in May this year, Rust has welcomed a faster compilation time and full support for dynamically-sized types. The release notes for version 1.3 highlight that "new object lifetime defaults have been turned on after a cycle of warnings about the change new object lifetime defaults." This is a breaking change, changing types like &'a Box<Trait> from being interpreted as &'a Box<Trait+'a> to &'a Box<Trait+'static>.

Contributor Aaron Turon explained the change in RFC 1156, saying

"When we instituted default object bounds, RFC 599 specified that &'x Box<Trait> (and &'x mut Box<Trait>) should expand to &'x Box<Trait+'x> (and &'x mut Box<Trait+'x>). This is in contrast to a Box type that appears outside of a reference (e.g., Box<Trait>), which defaults to using 'static (Box<Trait+'static>). This decision was made because it meant that a function written like so would accept the broadest set of possible objects.

The stable 1.3 release for Rust also delivers several performance improvements, including improved speed for the substring search by using the two way algorithm and adapting it to the Pattern API, outperforming the old naive implementation.

Other noteworthy improvements include "improvements to zero filling that speed up Vec::resize and Read::read_to_end."

Addressing bug 25483, where StrSearcher was performing a naive string search, Rust contributor bluss said the "two way searcher algorithm has very small, constant space overhead, requiring no dynamic allocation. Our implementation is relatively fast, especially due to the byteset addition to the algorithm, which speeds up many no-match cases."

Rust 1.3 also brings preliminary support for targeting Windows XP and support for lint capping. More details about Rust 1.3 can be found in the release notes.

Rate this Article