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.
This Week in Rust is openly developed on Github. If you find any errors or omissions in this week's issue, please submit a PR.
The big story
This week in Rust was crazy. Rust boldly moved to 1.0 alpha status, and the effort put in to make it happen in the last week was staggering, involving a lot of massive patches, a lot of breakage, and not a lot of sleep. Thanks to everybody for pitching in.
Rust 1.0 is going to arrive very quickly and from now to then the focus is going to be on nestling it into a warm cradle of stability, getting the Cargo ecosystem on the stability bandwagon and making sure the stage is set for all those 1.0 newbies to have a swell ride.
It was discussed on Hacker News, /r/rust, /r/programming, LWN and surely other corners of the Internet.
What's cooking on master?
Around 171 pull requests were merged in the last week. It was a long week.
Now you can follow breaking changes as they happen!
Breaking Changes
- Boxed closures have finally been removed. The pull request includes a detailed description of the impact.
- Unused type parameters on
impl
s are prohibited. This fixes some soundness holes and generally makes things more sensible. RFC. int
anduint
have been renamed toisize
andusize
to emphasize that they are not the 'default' integers. The old names are temporarily behind theint_uint
feature gate to provide a transitionary window. Theint
anduint
modules are now calledisize
andusize
. RFC.- There are new restrictions in the orphan check for impls that ensure that if the implemented trait is not defined in the local crate that the Self type is constrained by local types. Fixes soundness holes revealed by multidispatch. The commit message includes more details.
c_str
andc_vec
have been redesigned. There are no longer any scenerios where Rust frees strings allocated by C, and the APIs are more consistent with modern conventions. Details in the RFC.- The
trait Foo for Sized?
syntax has been obsoleted after a short deprecation period.Self
is no longer implicitlySized
. - Likewise, the
Sized? T
syntax for trait bounds has been obsoleted in favor ofT: ?Sized
. - To futureproof for potential alternative designs, chain comparsion
operators like
a == b == c
must now be parenthesized. RFC. - The
FloatMath
trait has merged intoFloat
. std::kinds
is calledstd::marker
.- The
std::thread
API has changed again.spawn
always creates a detached thread, andscoped
creates one which must be joined. The intention is that by requiring a completely different name to create an attached thread it will be harder to accidentally create a deadlock by misunderstanding the join semantics. - The
target_word_size
compiler-defined cfg value has been renamed totarget_pointer_width
.
Other Changes
- Feature staging has been partially implemented in a series of
patches. Under the current behavior, stability attributes
only mean anything when applied to the crates distributed with Rust
(primarily std), and the 'experimental' stability level has merged
into 'unstable'. Use of unstable APIs is now a warning on the
nightly and beta (alpha) release channels, and a new lint,
unstable_features
, that checks for activation of feature gates, is set to warn in betas. RFC. - The various guides have been merged into a book called 'The Rust Programming Language'.
- The
box
has been hidden behind thebox_syntax
feature gate. until it is more fully-baked. For the primary use of constructing boxes, just useBox::new
for now. /r/rust. - Syntax for negative impls has been added been
added behind the
optin_builtin_traits
feature gate. This will letSync
andSend
be implemented completely in the library eventually. RFC. - Florian Hahn landed a series of patches to improve the model lexer.
New Contributors
- Cristian Kubis
- Dabo Ross
- Daniel Grunwald
- Dylan Ede
- FakeKane
- Guillaume Gomez
- Hyeon Kim
- Jakub Vrána
- John Ericson
- John Kåre Alsaker
- Kelvin Ly
- Kevin Rauwolf
- Laurence Tratt
- Mike English
- Nathan Stoddard
- Peter Schuller
- Raul Gutierrez S
- Sean T Allen
- Thiago Pontes
- Tim Dumol
- York Xiang
- 克雷
Approved RFC's
- 447: Prohibit unused type parameters in impls. Disallows unconstrained type parameters in trait impls to clean up semantics. PR.
- 494: Stabilize
c_str
andc_vec
. Overhauls these two interop modules for modern tastes. PR. - 501: Consistent no_prelude attribute. Renames
no_implicit_prelude
tono_prelude
and makes it only apply to the current module. PR. - 507: Release channels. The post-1.0 release model and the 'feature staging' process by which new features are intrtoduced. PR.
- 526: Statically enforce unicode in
std::fmt
. By makingfmt
only deal in unicode some almost-always-redundant sanity checks can be eliminated. PR. - 544: Rename
int
/uint
. Renamesint
toisize
anduint
tousize
. PR. - 558: Require parentheses for chained comparisons. Minor
futureproofing that leaves open the option of making
a == b == c
behave more like people expect. PR.
New RFC's
- Macro future proofing. Places restrictions on some
macro_rules!
matchers to allow for Rust's grammer to evolve in the future (the implementation has already landed). - Unchecked downcast methods for
Any
. New unsafe methods are added toAny
for unchecked downcasting, a small performance and code-bloat-avoidance optimisation in cases where the dynamic type is already known. - Lifetime parameters for unsafe pointer conversions. APIs for handling lifetimes correctly when dealing with raw pointers.
- Integer overflow. Change the semantics of built-in integer types to be a program error on overflow. Implementations are not required to check for these errors except in debug mode. Adds wrapping int types to the library.
- Remove official
ndebug
variable support. A more rusty solution to turning on debug assertions. - Relative paths by default. Make paths in
use
statements relative instead of absolute. - Guidelines for
fmt::Show
andfmt::String
. When to use which of the two format types that convert to strings. - A byte string concatenation macro. Add a
bytes!
macro that produces static expressions of type&'static [u8]
by concatenating the arguments. - Lose the tick. Remove the tick from some parts of the lifetime syntax.
- Add methods to
String
andVec
which can remove multiple elements at once. Adsremove_range
toVec
andString
to remove multiple elements efficiently. - Change
foo::<T>(x)
tofoo@<T>(x)
. A different syntax for solving the ambiguity. - Reserve
#[rustc_*]
for future language features. Futureproofing around the lack of namespacing an attributes.
Community
The #rust IRC channel now peaks at more than 900 users.
From the Team
- Announcing Rust 1.0 Alpha. HN. /r/rust. /r/programming.
- weekly-meetings/2015-01-06. fott; 1.0 alpha priorities; LLVM
updates; the fate of
box
Blog Posts
- Peeking inside Trait Objects. Huon explains the runtime representation of Rust's opaque types. /r/rust.
- The Sized trait. Then Huon explains DST. /r/rust.
- Object safety. Then Huon explains the conditions under which a trait may be cast to an object. /r/rust.
- Rust Patterns: Using traits for function overloading. Jonathan Reem demonstrates how to overload functions. /r/rust.
- My experience converting a project from Rust 0.12 to 1.0 (alpha). Looks painful...
- Is now a good time to learn Rust?. A: wait 6-12 weeks. /r/programming.
- Iomrascálaí: A Great Way to Learn Rust or About AI. An AI for the game of Go.
- Notch says something about Rust. Rust is official.
Discussions
- Rust book by Packt Publishing. There is opportunity to be involved in one of the first Rust books.
- Final decision on builtin integer types. Again. Aftermath.
- Operating system development in Rust. Well-commented hacker news discussion. Nothing new though.
- 151-byte static binary in Rust. Keegan shows that Rust can be small. /r/rust. /r/programming.
- "hello world" contains Lovecraft quotes. /me eyerolls
- Google removes rust, Netflix, other GitHub repos after DMCA takedown. 'Cargo' looks suspiciously like pornography. /r/rust.
- How big a deal is Rust, Really? A: the biggest.
- Pre-RFC: Linear type modifier. Requires certain types to be explicitly disposed.
- Using Rust 1. for video game development?. Some up to date info here.
New Projects
- multirust. Manage multiple Rust toolchains.
- Roogle. Hoogle 4 Rust.
- Rust for Clojurists. An introduction to Rust. /r/programming.
- Clippy for Rust. A collection of lints. /r/rust.
- rust-blas. Bindings to the immortal BLAS numerical library.
- fallthrough. A macro for fall-through match cases.
- rust-vobject. A vObject/iCalendar parser.
- ProjectEuler. A new attempt at the Project Euler problems.
- forkallcc. Continuations with fork(2)!
- construct. A macro for building arbitrary collections.
- float_macros. CTFE for some float functions.
Project Updates
- This Week in Servo 18.
- Grisu and rust-strconv. Yurume talks about his implementation of the Grisu algorithm for converting floats to strings. This work is likely to make it into std someday.
- Announcing support for 1.0 in Rust Explorer. Shows the assembly of Rust code.
Upcoming Events
January 12 - Seattle Meetup. January 17 - Beijing Meetup. Presantations about servo and zmq.rs. January 17 - Getting starting contributing to Rust. A special SF Bay area meetup.