Hello and welcome to another issue of This Week in Rust! Rust is a programming language empowering everyone to build reliable and efficient software. This is a weekly summary of its progress and community. Want something mentioned? Tag us at @ThisWeekInRust on Twitter or @ThisWeekinRust on mastodon.social, 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
Foundation
Project/Tooling Updates
Observations/Thoughts
- Improving build times for derive macros by 3x or more
- Oxidizing bmap-tools: rewriting a Python project in Rust
- Rust: A New Attempt at C++'s Main Goal
- Traits are more than interfaces
- Optional If Expressions
- Building a GStreamer plugin in Rust with meson instead of cargo
- Rutie and Magnus, Two Good Ways to Build Ruby Extensions in Rust
- Two Rust features that I miss in Other languages
- [audio] Rust Analyzer with Lukas Wirth
- [audio] Wasmer with Syrus Akbary
Rust Walkthroughs
- Understanding Rust Thread Safety
- how to run rust code on a circuit playground classic / atmega32u4
- Hello World in Rust for m68k with #[no_core] and compiler patches
- A syntax-level async join macro supporting branching control flow and synchronous shared mutable borrowing
- Build a Lua Interpreter in Rust (English version)
- [CN] Zino's implementation of an error type with tracing functionalities using 100 lines of code
Miscellaneous
- Introducing Shuttle Batch 2.0
- The Rust Foundation's draft trademark policy is far too restrictive
- [video] Rust Trademark: Argle-bargle or Foofaraw?
Crate of the Week
This week's crate is onlyerror, a #[derive(Error)]
macro with support for no_std
on nightly compilers.
Thanks to Jay Oster for the self-suggestion!
Please submit your suggestions and votes for next week!
Call for Participation
Always wanted to contribute to open-source projects but did not 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.
- Quickwit - Upgrade clap from 3.1 to 4.0
- Quickwit - Implement quickwit dataset CLI command
- Hyperswitch - Migrate to
enum_dispatch
to reduce runtime overhead - Hyperswitch - move redis key creation to a common module
- Hyperswitch - add
connector_label
field in error type - Ockam - Update
ockam status --all
to list more of the available resources - Ockam - Remove
rustcrypto
feature fromockam_vault
- Ockam - Create Github Action to update Ockam Command Manual
If you are a Rust project owner and are looking for contributors, please submit tasks here.
Updates from the Rust Project
450 pull requests were merged in the last week
- initial support for loongarch64-unknown-linux-gnu
- add inline assembly support for m68k
- make rust-intrinsic ABI unwindable
- allow
repr(align = x)
on inherent methods - add a backtrace to Allocation, display it in leak reports
- add a message for if an overflow occurs in
core::intrinsics::is_nonoverlapping
- add suggestion to remove
derive()
if invoked macro is non-derive - added diagnostic for
pin!
macro in addition toBox::pin
if Unpin isn't implemented - assemble
Unpin
candidates specially for generators in new solver - check for body owner fallibly in error reporting
- correct default value for default-linker-libraries
- emits non-overlapping suggestions for arguments with wrong types
- encode def span for
ConstParam
- erase lifetimes above
ty::INNERMOST
when probing ambiguous types - erase regions when confirming transmutability candidate
- fix false positives for
unused_parens
around unary and binary operations - fix transmute intrinsic mir validation ICE
- fix: ensure bad
#[test]
invocs retain correct AST - fix: skip implied bounds if unconstrained lifetime exists
- improve safe transmute error reporting
- improve the error message when forwarding a matched fragment to another macro
- incr.comp.: make sure dependencies are recorded when feeding queries during eval-always queries
- preserve argument indexes when inlining MIR
- reformulate
point_at_expr_source_of_inferred_type
to be more accurate - report overflows gracefully with new solver
- resolve: pre-compute non-reexport module children
- tweak output for 'add line' suggestion
- suggest lifetime for closure parameter type when mismatch
- support safe transmute in new solver
- add a stable MIR way to get the main function
- custom MIR: Support
BinOp::Offset
- switch to
EarlyBinder
forimpl_subject
query - tagged pointers, now with strict provenance!
- alloc
hir::Lit
in an arena to remove the destructor fromExpr
- only emit alignment checks if we have a
panic_impl
- only enable ConstProp at
mir-opt-level >= 2
- permit MIR inlining without
#[inline]
rustc_metadata
: Filter encoded data more aggressively usingDefKind
- stabilize IsTerminal
- don't splice from files into pipes in
io::copy
sync::mpsc
: synchronize receiver disconnect with initialization- windows: map a few more error codes to ErrorKind
- hashbrown: remove drain-on-drop behavior from DrainFilter
- regex: first phase of migrating to regex-automata
- cargo: change -C to be unstable
- cargo: stabilize
cargo logout
- cargo: use registry.default for login/logout
- cargo: use restricted Damerau-Levenshtein algorithm
- rustdoc-search: add support for nested generics
- rustdoc: correctly handle built-in compiler proc-macros as proc-macro and not macro
- stabilize rustdoc
--test-run-directory
- clippy:
collection_is_never_read
: Handle unit type - clippy: add
manual_slice_size_calculation
applicable suggestion - clippy: clear with drain
- clippy: fix false positives and false negatives in
octal_escapes
- clippy: suggest
std::mem::size_of_val
instead ofstd::mem::size_of_value
- rust-analyzer: don't suggest unstable items on stable toolchain
- rust-analyzer: make inlay hints insertable
- rust-analyzer: map tokens from
include!
expansion to the included file - rust-analyzer: fix allow extracting function from single brace of block expression
- rust-analyzer: fix explicit deref problems in closure capture
- rust-analyzer: bring back LRU limit for
macro_expand
query - rust-analyzer: fix inference in nested closures
- rust-analyzer: fix inverted code lens resolve file version check
- rust-analyzer: fix receiver adjustments for
extract_variable
assist - rust-analyzer: infer types of nested RPITs
- rust-analyzer: when running the "discoverProjectCommand", use the Rust file's parent directory instead of the workspace folder
- rust-analyzer: parse more exclusive range patterns and inline const patterns
Rust Compiler Performance Triage
A busy two weeks (as last week perf triage was not done). Overall improvements outweigh regressions with an average improvement of -2.6% across a large swath of the test cases. Of particular note was the move to use SipHash-1-3 instead of SipHash-2-4 for StableHasher which improved 184 benchmark tests by an average of 2.3%!
Triage done by @rylev. Revision range: 7c96e40..74864f
Summary:
(instructions:u) | mean | range | count |
---|---|---|---|
Regressions ❌ (primary) |
3.1% | [0.2%, 24.4%] | 11 |
Regressions ❌ (secondary) |
4.9% | [0.4%, 37.4%] | 32 |
Improvements ✅ (primary) |
-2.9% | [-20.4%, -0.3%] | 205 |
Improvements ✅ (secondary) |
-4.0% | [-43.5%, -0.3%] | 160 |
All ❌✅ (primary) | -2.6% | [-20.4%, 24.4%] | 216 |
6 Regressions, 8 Improvements, 11 Mixed; 6 of them in rollups 119 artifact comparisons made in total
Approved RFCs
Changes to Rust follow the Rust RFC (request for comments) process. These are the RFCs that were approved for implementation this week:
- No RFCs were approved this week.
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.
RFCs
- No RFCs entered Final Comment Period this week.
Tracking Issues & PRs
- [disposition: merge] Update the version of musl used on
*-linux-musl
targets to 1.2.3 - [disposition: merge] Tracking Issue for
debugger_visualizer
New and Updated RFCs
- [new] Use
actions/deploy-pages
to deploymdbook
output - [new] RFC for associated mathematical constants
- [new] improve
#[may_dangle]
for type parameters - [new] RFC: Cargo feature descriptions & metadata
- [new] RFC: Rustdoc configuration via Cargo
- [new] Traits for lossy conversions
- [new] Split may_dangle and make PhantomData less weird
Call for Testing
An important step for RFC implementation is for people to experiment with the implementation and give feedback, especially before stabilization. The following RFCs would benefit from user testing before moving forward:
If you are a feature implementer and would like your RFC to appear on the above list, add the new call-for-testing
label to your RFC along with a comment providing testing instructions and/or guidance on which aspect(s) of the feature
need testing.
Upcoming Events
Rusty Events between 2023-04-19 - 2023-05-17 🦀
Virtual
- 2023-04-19 | Virtual (Vancouver, BC, CA) | Vancouver Rust
- 2023-04-20 | Virtual (Munich, DE) | Rust Munich
- 2023-04-20 | Virtual (Stuttgart, DE) | Rust Community Stuttgart
- 2023-04-25 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-04-26 | Virtual (Cardiff, UK) | Rust and C++ Cardiff
- 2023-04-27 | Virtual (Charlottesville, VA, US) | Charlottesville Rust Meetup
- 2023-04-27 | Copenhagen, DK | Copenhagen Rust Community
- 2023-04-29 | Virtual (Nürnberg, DE) | Rust Nuremberg
- 2023-05-02 | Virtual (Buffalo, NY, US) | Buffalo Rust Meetup
- 2023-05-03 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2023-05-09 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-05-11 | Virtual (Nürnberg, DE) | Rust Nuremberg
- 2023-05-13 | Virtual | Rust GameDev
- 2023-05-16 | Virtual (Washington, DC, US) | Rust DC
- 2023-05-17 | Virtual (Cardiff, UK) | Rust and C++ Cardiff
- 2023-05-17 | Virtual (Vancouver, BC, CA) | Vancouver Rust
Europe
- 2023-04-19 | Paris, FR | Rust Paris
- 2023-04-19 | Trondheim, NO | Rust Trondheim
- 2023-04-19 | Zurich, CH | Rust Zurich
- 2023-04-20 | Aarhus, DK | Rust Aarhus
- 2023-04-20 | Munich, DE + Virtual | Rust Munich
- 2023-04-20 | Bern, CH | Rust Bern
- 2023-04-21 | Stuttgart, DE | Rust Community Stuttgart
- 2023-04-26 | London, UK | Rust London User Group
- 2023-04-27 | Bordeaux, FR | DedoTalk
- 2023-04-27 | Vienna, AT | Rust Vienna
- 2023-05-02 | Amsterdam, NL | Rust Developers Amsterdam Group
- 2023-05-10 | Amsterdam, NL | RustNL
North America
- 2023-04-19 | Austin, TX, US | Rust ATX
- 2023-04-19 | Minneapolis, MN, US | Minneapolis Rust Meetup
- 2023-04-20 | Mountain View, CA, US | Mountain View Rust Study Group
- 2023-04-29 | Durham, NC, US | Triangle Rust
- 2023-05-11 | Lehi, UT, US | Utah Rust
- 2023-05-16 | San Francisco, CA, US | San Francisco Rust Study Group
Oceania
- 2023-04-27 | Brisbane, QLD, AU | Rust Brisbane
- 2023-05-03 | Christchurch, NZ | Christchurch Rust Meetup Group
If you are running a Rust event please add it to the calendar to get it mentioned here. Please remember to add a link to the event too. Email the Rust Community Team for access.
Jobs
Please see the latest Who's Hiring thread on r/rust
Quote of the Week
Error types should be located near to their unit of fallibility.
Thanks to Anton Fetisov for the suggestion!
Please submit quotes and vote for next week!
This Week in Rust is edited by: nellshamrell, llogiq, cdmistman, ericseppanen, extrawurst, andrewpollack, U007D, kolharsam, joelmarcey, mariannegoldin, bennyvasquez.
Email list hosting is sponsored by The Rust Foundation