Hello and welcome to another issue of This Week in Rust! Rust is a systems language pursuing the trifecta: safety, concurrency, and speed. This is a weekly summary of its progress and community. Want something mentioned? Tweet us at @ThisWeekInRust or send us a pull request. Want to get involved? We love contributions.
This Week in Rust is openly developed on GitHub. If you find any errors in this week's issue, please submit a PR.
Updates from Rust Community
News & Blog Posts
- Writing a command line tool in Rust.
- A simple tip to improve Rust program speed.
- Exporting a GObject C API from Rust code and using it from C, Python, JavaScript and others.
- Futures and gRPC in Rust.
- Rust compile time mandelbrot.
- Rust and QML: a timely example.
- How glib-rs works, part 3: Boxed types.
- Signed vs unsigned: On integer types in Rust.
- This week in Rust docs 72.
Crate of the Week
This week's crate is pikkr, a JSON parser that can extract values without tokenization and is blazingly fast using AVX2 instructions, Thank you, bstrie for the suggestion!
Submit your suggestions and votes for next week!
Call for Participation
Always wanted to contribute to open-source projects but didn't know where to start? Every week we highlight some tasks from the Rust community for you to pick and get started!
Some of these tasks may also have mentors available, visit the task page for more information.
- [less easy] bindgen: Allow specifying certain types we shouldn't derive/impl Debug for.
- [less easy] bindgen: Allow specifying certain types we shouldn't derive/impl Copy for.
- [less easy] bindgen: Allow specifying certain types we shouldn't derive/impl Default for.
- [less easy] bindgen: Allow specifying certain types we shouldn't derive/impl Hash for.
- [less easy] bindgen: Allow specifying certain types we shouldn't derive/impl PartialEq for.
- [easy] bindgen: bindgen generates erroneous rust code: error: expected identifier, found
_
. - [less easy] bindgen: Rewrite
is_unsized
as a fix-point analysis. - [less easy] bindgen: Large bitfield causes compilation failures re:
derive(Debug)
. - [easy] bindgen: Add a
Builder::blacklist_type
method; deprecateBuilder::hide_type
. - [easy] bindgen: Add
Builder::whitelist_function
; deprecateBuilder::whitelisted_function
. - [easy] bindgen: Add
Builder::whitelist_var
; deprecateBuilder::whitelisted_var
. - [easy] bindgen: Add
Builder::whitelist_type
; deprecateBuilder::whitelisted_type
. - [easy] bindgen: TemplateParameters' methods should just return a Vec, not an Option
. - [easy] bindgen: Make BindgenOptions be pub(crate).
- [medium] allocators-rs: elfmalloc: Handle thread-local storage on platforms without
#[thread_local]
. - [medium] allocators-rs: slab-alloc: Create mechanism for supporting time in no-std and no-os.
- [medium] allocators-rs: bsalloc: Support allocation failures.
- [easy] allocators-rs: Add links in documentation.
- [medium] allocators-rs: Travis: Spurious test failures on Mac.
- [easy] allocators-rs: AppVeyor: Mark appveyor.sh files executable.
- [easy] allocators-rs: test-scripts/check-copyright-comments.sh: Fix comment typo.
If you are a Rust project owner and are looking for contributors, please submit tasks here.
Updates from Rust Core
99 pull requests were merged in the last week
- improved message on
&str
vs.&[u8]
literals - hint on overlapping inter-crate ambiguities
#![feature(drop_types_in_const)]
- proper expansion info for more builtin macros
- macros 2.0 now have their
Span
include visibility modifiers - use
NodeId
/HirId
instead ofDefId
for local vars - avoid hashing every
HirId
in existence SplitWhitespace
now implementsDebug
_.clamp(min, max)
forOrd
types- panic on overflow in
Instance
±Duration
- the
LocalKey
facade ofthread_local!
is now inlineable cross-crate - avoid creating
static
s for eachpanic
- MIR no longer emits
EndRegion
s by default - MIR: restrict
ProjectionElem::Index
andStorage
{Live
,Dead
} toLocal
- MIR: no longer inlines trait methods
- MIR: inliner bug fixed
- macOS users can get backtraces again
- fix macOs segfault
- more metadata methods are queries
rustc_metadata
no longer needsDepGraph
handling, remove it (now querified)- rustc now deals correctly with really long linker commands
- rustbuild can use hardlinks again, reduces copies (my small SSD rejoices)
- cargo: hash dependencies of metadata into lib's metadata
- cargo: don't loop forever on cyclical features
- cargo: support vendoring git repositories
New Contributors
- bgermann
- Douglas Campos
- Ethan Dagner
- Jacob Kiesel
- John Colanduoni
- Lance Roy
- Mark
- MarkMcCaskey
- Max Comstock
- toidiu
- Zaki Manian
Approved RFCs
Changes to Rust follow the Rust RFC (request for comments) process. These are the RFCs that were approved for implementation this week:
- RFC 2115: In-band lifetime bindings.
- RFC 2128: Nested groups in imports.
- RFC 2089: Implied bounds.
- RFC 2132: Copy/Clone closures.
- RFC 2086: Allow Irrefutable Patterns in if-let and while-let statements.
- RFC 2043: Add
align_offset
intrinsic and[T]::align_to
function. - RFC 2070: stable mechanism to specify the behavior of panic! in no-std applications.
- RFC 2093: Infer
T: 'x
outlives requirements on structs. - RFC 2133: Compiler-generated Clone impls for arrays and tuples.
Final Comment Period
Every week the team announces the 'final comment period' for RFCs and key PRs which are reaching a decision. Express your opinions now. This week's FCPs are:
- [disposition: merge]
dyn Trait
syntax for trait objects: Take 2. - [disposition: merge] Introduce a public/private distinction to crate dependencies.
- [disposition: merge] Fallible collection allocation 1.0.
- [disposition: merge] Autoreferencing
Copy
types. - [disposition: merge] Attributes for tools, 2.0.
- [disposition: merge] Add impl Trait type alias and variable declarations.
- [disposition: merge] Evolving Rust through Epochs.
- [disposition: merge]
cfg!(target_feature)
and#[target_feature]
. - [disposition: postpone] Allow comparisons between integers of different types.
- [disposition: merge] Const generics.
- [disposition: merge] Add external doc attribute to rustc.
- [disposition: merge] Change the default URL of doc.rust-lang.org.
- [disposition: merge] Clarify and streamline paths and visibility.
New RFCs
- Add support to Cargo for alternative registries.
- Type privacy and private-in-public lints.
- Allow autoderef and autoref in operators.
- Adding unsafe modules and unsafe blocks outside functions.
- Add match/in statements.
Style RFCs
Style RFCs are part of the process for deciding on style guidelines for the Rust community and defaults for Rustfmt. The process is similar to the RFC process, but we try to reach rough consensus on issues (including a final comment period) before progressing to PRs. Just like the RFC process, all users are welcome to comment and submit RFCs. If you want to help decide what Rust code should look like, come get involved!
The RFC style is now the default style in Rustfmt - try it out and let us know what you think!
We're currently writing up the discussions, we'd love some help. Check out the tracking issue for details.
PRs:
Upcoming Events
- Sep 14. Rust Washington, DC - Hacktember.
- Sep 14. Columbus Rust Society - Monthly Meeting.
- Sep 14. St. Petersburg, Russia - Game Development in Rust.
- Sep 20. Rust Community Team Meeting at #rust-community on irc.mozilla.org.
- Sep 20. Rust Documentation Team Meeting at #rust-docs on irc.mozilla.org.
- Sep 20. OpenTechSchool Berlin - Rust Hack and Learn.
- Sep 21. Rust release triage.
- Sep 24. Rust Indonesia - Level up Your Knowledge on Rust.
- Sep 25. Rust Paris Meetup #38.
- Sep 27. Rust Community Team Meeting at #rust-community on irc.mozilla.org.
- Sep 27. Rust Documentation Team Meeting at #rust-docs on irc.mozilla.org.
- Sep 28. Mozilla Community Dresden - Rust Meetup.
- Sep 30 - Oct 1. RustFest Zürich.
- Sep 30. Rust Mexico #8: Taller Introductorio a Rust y Rocket.
- Oct 2 - Oct 3. Impl Days at RustFest Zürich.
If you are running a Rust event please add it to the calendar to get it mentioned here. Email the Rust Community Team for access.
Rust Jobs
No jobs listed for this week.
Tweet us at @ThisWeekInRust to get your job offers listed here!
Quote of the Week
When programmers are saying that there are a lot of bicycles in code that means that it contains reimplementations of freely available libraries instead of using them
Presumably the metric for this would be bicyclomatic complexity?
— /u/tomwhoiscontrary on reddit.
Thanks to Matt Ickstadt for the suggestion.