Hello and welcome to another issue of This Week in Rust! Rust is a systems language pursuing the trifecta: safe, concurrent, and fast. This is a weekly summary of its progress and community. Want something mentioned? Send me an email! Want to get involved? We love contributions.
We also have a new guide to error handling.
What's cooking on master?
100 pull requests were merged in the last week.
- Enum variants are now namespaced by their type name, a major change. Enums in the standard library have been reexported in their old locations, for now at least. RFC. Reddit.
- Collections have been modified to no longer require the various
_equivmethods, which are now deprecated. Methods that search by key and value now often take a generic type that implements
BorrowFrom, which converts e.g. both
- As part of ongoing DST-ification,
AsSlicehas been modified to work with unsized types. This breaks existing code because
AsSlicetype vars should now be taken by reference. At the same time, some of the ops have been extended to work with unsized types.
slice_shift_char's return type has changed slightly.
find_copycan be performed with
map.get(&key).cloned(), which converts the
map[key].clone(), which calls
.clone()on the value returned by reference from the indexing operator.
- Runtime removal continues. Breaking changes here are mostly to code invoking the runtime directly.
unboxed_closure_sugarfeature gates have been combined into a single
- Formatting has seen a stability pass with some minor breaking changes. RFC.
- The little-used
col!macro is renamed to
- Non-ASCII lifetime identifiers are behind the
non_ascii_identsfeature gate as intended.
- Struct variants can not be matched as if they were tuple variants.
- There have been several breaking changes and deprecations to
- Likewise, there have been a number of changes to the code dealing with raw string and vector processing.
- Rust now supports higher-ranked trait bounds. This is necessary to make unboxed closures work, but the implications are quite complex. Read the RFC for details.
- All statics now support the
#[linkage]attribute, which is behind the
- Parts of rustc have been pulled into a new
rustc_transcrate to reduce memory pressure.
- All idents following literals are tokenized specially now as future proofing. RFC.
- Unboxed closures can be written with the sugared syntax.
- Andrew Cann
- Gleb Kozyrev
- Jashank Jeremy
- Joonas Javanainen
- Nicholas Bishop
- Simon Wollwage
- Vadim Petrochenkov
- Higher-ranked trait bounds: Makes the type-system powerful enough to deal with unboxed closures as well as boxed ones.
- RFC to restrict placing an identifier after a literal.: Future-proofs syntax for literals
- Finalizing more naming conventions: snake_case-type stuff and
- Change precedence of
+in type grammar: Cleans up a some weird parsing interactions
- cmp and ops reform: DST-ify operators, add multi-dispatch, make them by-value for
flexibility, add IndexSet, unify slice operators with
..notation sugaring to special types, kill Equiv
- Add a thread local storage module, std::tls: Introduces Scoped TLS and Owned TLS in a new thread_local module to replace the old design. Should have better perf, be more flexible.
- Release channels and feature staging: This RFC describes changes to the Rust release process, primarily the division of Rust's time-based releases into 'release channels', following the 'release train' model used by e.g. Firefox and Chrome; as well as 'feature staging', which enables the continued development of experimental language features and libraries APIs while providing strong stability guarantees in stable releases.
- path reform: This RFC reforms the design of the std::path module in preparation for API stabilization. The path API must deal with many competing demands, and the current design handles many of them, but suffers from some significant problems given in "Motivation" below. The RFC proposes a redesign modeled loosely on the current API that addresses these problems while maintaining the advantages of the current design.
- placement box with Placer trait for overloading: Add user-defined placement in expression (more succinctly, "an in expression"), an operator analogous to "placement new" in C++. This provides a way for a user to specify (1.) how the backing storage for some datum should be allocated, (2.) that the allocation should be ordered before the evaluation of the datum, and (3.) that the datum should preferably be stored directly into the backing storage (rather than allocating temporary storage on the stack and then copying the datum from the stack into the backing storage).
- Feature gate box patterns: Move box patterns behind a feature gate.The general idea is good, but the semantics aren't baked enough for 1.0.
- Add "function name macro": This RFC proposes the addition of a function! macro that expands to the function it's used in. This will greatly help error reporting.
Karen Rustad found a wild rustacean.
From the Team
- Weekly-meetings/2014-11-18: cmp/ops; TLS; future-proofing literal parsing; ungating tuple indexing, if/while let; naming conventions; struct variants matching; for syntax for higher-order lifetimes; macros; type parameter grammar; better shepherding Reddit.
- Cargo: Rust's community crate host.
- Introduction to programming safe and efficient systems in Rust. Jakub Bukaj at Øredev.
- Rust, Lifetimes, and Collections. Alexis Beingessner (aka Gankro), who has been driving the current modernization of the collections libs, talks about the design of collections in Rust. Reddit. HN.
- Chasing an EPROTOTYPE Through Rust, Sendto, and the OSX Kernel With C-Reduce. Reddit.
- Rust tools. Nick Cameron has been thinking about the state of Rust tooling. Reddit.
- Roguelike Tutorial in Rust: Part 5: Combat! Part III. Reddit.
- What are the advantages of Rust over modern C++?
- What does 'unwrap' mean in Rust?
- How would a Rust application be able to properly react to low level failures, like memory allocation failure?
- The Race Towards 1.0 and The Standard Library.
- Is Rust recommended for beginners with 0 programming language experience?. TL;DR it depends.
- Feedback wanted: improved Rust error handling. More experiments from mitsuhiko.
- Benchmarks on different Map implementations for uint keys.
- rust-eh. Python-like error tracebacks, from mitsuhiko.
- rust-incidents. More error experiments from mitsuhiko.
sl, the classic Unix command, in Rust.
- img_hash. Perceptual hashing of images.
- raw-rs. Utilities for manipulation of Rust core types.
- rust-uchardet. Encoding detection.
- Rust-Relay. IRC client library. Start your bots!
- cargo-do. Cargo plugin for running multiple commands at once.
- dbus-rs. D-Bus bindings.
- wire. An abstraction over TCP and binary serialization.