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 issue brought to you by the fantastic Brian Anderson and Alexis Beingessner!

What's cooking on master?

101 pull requests were merged in the last week. Woo!

Breaking Changes

Other Changes

  • New blanket impls of the unboxed closure types allow them to interoperate. See test cases for examples.
  • impls can now be defined on trait objects.
  • P1start has been converting compiler messages that provide suggestions from 'notes' to 'help' messages.
  • The exceeding_bitshifts lint catches overlong shifts (which are currently undefined behavior) of static size. Due to bugs it is set to 'allow' be default.
  • Ariel removed a bunch of unsafe code from the compiler. Yay!
  • A new -l flag to the compiler has been added to specify linkage to native libraries, primarily for use by cargo. In the same PR, include! was updated to expand its arguments, allowing cargo to do for more complex compile-time code generation. RFC.
  • #![cfg] and #[cfg_attr] can be applied to crates.
  • On x86 Linux, random number generation now prefers the new [getrandom] syscall.

New Contributors

  • Cristi Burcă
  • juxiliary
  • Nathan Zadoks
  • qwitwa
  • Sean Jensen-Grey
  • Subhash Bhushan
  • thiagopnts
  • tshakah
  • Vitali Haravy
  • Vladimir Matveev
  • whataloadofwhat

Approved RFC's

  • Num reform: Strips down std::num to minimally support generic primitive numbers, without supporting a full mathematical hierarchy.
  • Higher-ranked trait bounds: Add the ability to have trait bounds that are polymorphic over lifetimes. Necessary for unboxed closures.
  • un-feature-gating struct variants: Woo!
  • Multiple lifetime bounds: Removes special cases from the type system and allows more complex lifetime relationships to be expressed that were previously only inferable.

New RFC's

  • Macro reform: Prepares macros for 1.0 stabilization. Renames macro_rules! to macro!, and introduces more robust support for module importing and exporting.
  • Change integer fallback RFC to suggest i32 instead of int as the fallback: Changes the fallback for performance and portability.
  • Un-feature-gate if let and tuple indexing: The features are well-behaved and used by many projects; ship 'em!
  • Prohibit unused type parameters in impls: Require that every impl type parameter appears textually within the input type parameters of the trait reference or the impl self type.
  • ES6-style unicode string escaping: Remove \u203D and \U0001F4A9 unicode string escapes, and add ECMAScript 6-style \u{1F4A9} escapes instead. Strong positive feedback, some concern with how it interacts with format strings.
  • extension trait conventions: Establishes a definition and naming convention for extension traits: traits which aren't intended for generic programing, but instead extending existing types. If extending a Foo, use FooExt. If Extending a Foo when it impls another trait like Add, use FooAddExt.
  • cmp and ops reform: Refactors Cmp and the operator overloading traits. Generally positive feedback. Highlights include:
    • Make basic unary and binary operators work by value and use associated types.
    • Generalize comparison operators to work across different types; drop Equiv.
    • Refactor slice notation in favor of range notation so that special traits are no longer needed.
    • Add IndexSet to better support maps.
    • Clarify ownership semantics throughout.
  • Change precedence of + in type grammar: Update type grammar to make + have lower precedence, consistent with the expression grammar, resolving a grammatical ambiguity.
  • Relocate and improve c_str:
    • Move the c_str module out of std to rid the latter of type dependencies on libc.
    • Split the current CString into a low-level type CStrBuf and a length-aware CString to make computation costs explicit.
    • Provide custom destructors and purpose-specific, mnemonically named constructors.
    • Add some methods and trait implementations to make the types more useful.
    • Remove the Clone implementation due to lack of purpose.
  • rename lifetime to scope: Highly controversial. Some community members argue that this change in terminology has been much more effective when introducing the actual concepts to newbies. Others argue that scope is already a well established concept in programming languages.
  • Finalizing more naming conventions: finalizes a few long-running de facto conventions, including capitalization/underscores, and the role of the unwrap method. Generally positive feedback, some discussion of naming consts like enum variants.
  • Reserve macro identifiers: Preemptively reserve a class of $ identifiers for allowing backwards compatible improvements to the macro system.

Community

From the Team

Videos

  • An introduction to Servo: Lars Bergstrom from the Research team provides an overview of the Servo project, demonstrates its current status, and shows how to contribute to it.
  • November's Bay Area meetup happened on Thursday, featuring five presentations about Servo and browser architecture.

Blog Posts

Discuss

  • Pre-RFC: placement box with Placer trait: Add user-defined placement box expression (more succinctly, "a box 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 temporary storage on the stack and then copying the datum from the stack into the backing storage).
  • Forbid -(unsigned integer): the eternal struggle continues. It's super handy when you want it, but also a common error to make.
  • Moving all built-in macros to plugins: Another proposal to handle some of the issues with macros for 1.0. May make it easier to bootstrap changes to the compiler.
  • Lifetime Notation: &'a -> a&. Some discussion of tradeoffs and details.
  • Poll: Foo::new() vs Foo() as the default constructor

Reddit

New Projects

  • this-week-in-rust: This Week in Rust's content is now publicly hosted in a Github repo! If you find any errors, just submit a PR to the relevant markdown file in /content! If you'd like to help out, please contact cmr, brson, or Gankro on Github/Reddit/IRC.
  • rustaceans.org: This website is for finding Rustaceans. Wondering who is behind that GitHub username or IRC nick? Here is where to find out.
  • rust-modifier: Convenient chaining APIs for free
  • dockerfiles: Collection of lightweight and ready-to-use docker images
  • Window Tiling For The Win: A tiling window manager written in Rust
  • cxx2rs: A rust-binding generator for C/C++ files
  • sorting-rs: This is a set of sorting algorithms, written in Rust.
  • rust-chatserver: A barebone command line TCP chatserver written in Rust. Looking for feedback.
  • rust-irc: A simple example irc implementation. Looking for feedback
  • rusqlite: Ergonomic, semi-safe bindings to SQLite for Rust

Upcoming Meetups