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
- rust-analyzer changelog #162
- fltk-rs in 2022
- shuttle - Release v0.8.0
- This Week in Fyrox
- gitoxide - The year in retrospective, and what's to come
- The AeroRust community - 3 years birthday (and the roadmap for 2023)
- SeaQuery 0.28.0 - A dynamic query builder for SeaORM
- Databend 2022 Recap
Observations/Thoughts
- State Machines III: Type States
- Rust — vim — code completion
- How to Test
- Embedded Rust and Embassy: DMA Controllers
- Parsing TFTP in Rust
- Rustdoc JSON in 2022
- From PHP to Rust: Migrating a REST API between these two languages. (Part I)
- React + Rust + Wasm: Play an Animated 3D Model
- Open Source Grindset Explained (with a Rust example)
Rust Walkthroughs
- Building a Simple DB in Rust - Part 1
- Microservices with Rust and WASM using Fermyon
- Compiling Brainfuck code - Part 4: A Static Compiler
- Rusty Circuit Breaker 🦀
- Zero-dependency random number generation in Rust
Miscellaneous
- Rust 101: an open-source university course
- [video] If Rust Compiles, It WORKS (Testing not needed 📚)
- [video] Introduction to Axum
- [video] Ergonomic APIs for hard problems - Raph Levien
Crate of the Week
This week's crate is Sniffnet, a cross-platform GUI application to analyze your network traffic.
Thanks to Gyuly Vgc for the 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!
No calls for participation this week. Keep an eye out for more places to contribute next week!
If you are a Rust project owner and are looking for contributors, please submit tasks here.
Updates from the Rust Project
291 pull requests were merged in the last week
- CFI: monomorphize transparent ADTs before typeid
- account for
match
expr in single line - account for macros in const generics
- account for multiple multiline spans with empty padding
- adjust message on non-unwinding panic
- allow trait method paths to satisfy
const Fn
bounds - always suggest as
MachineApplicable
inrecover_intersection_pat
- detect diff markers in the parser
- detect when method call on LHS might be shadowed
- dont use
--merge-base
during bootstrap formatting subcommand - emit fewer errors on invalid
#[repr(transparent)]
onenum
- encode spans relative to the enclosing item -- enable on nightly
- error parsing lifetime following by Sized and message + between them
- fix confusing diagnostic when attempting to implementing trait for tuple
- format only modified files
- on unsized locals with explicit types suggest
&
- only deduplicate stack traces for good path bugs
- give the correct track-caller location with MIR inlining
- implement allow-by-default
multiple_supertrait_upcastable
lint - improve heuristics whether
format_args
string is a source literal - make trait/impl
where
clause mismatch on region error a bit more actionable - merge multiple mutable borrows of immutable binding errors
- partially fix
explicit_outlives_requirements
lint in macros - properly calculate best failure in macro matching
- provide a better error and a suggestion for
Fn
traits with lifetime params - provide local extern function arg names
- recover
fn
keyword asFn
trait in bounds - remove unreasonable help message for auto trait
- silence knock-down errors on
[type error]
bindings - suggest
Pin::as_mut
when encountering borrow error - suggest
impl Iterator
when possible for_
return type - suggest rewriting a malformed hex literal if we expect a float
- suppress errors due to TypeError not coercing with inference variables
- trim more paths in obligation types
- miri: cargo-miri: use rustc to determine the output filename
- miri: handle unknown targets more gracefully
- miri: simplify path joining code a bit
- miri: support using a JSON target file
- miri: tweaks to retag diagnostic handling
- use some more
const_eval_select
in pointer methods for compile times - more inference-friendly API for lazy
- more verbose
Debug
implementation ofstd::process:Command
- add
#[inline]
markers toonce_cell
methods - unify id-based thread parking implementations
available_parallelism:
gracefully handle zero valuecfs_period_us
- catch panics/unwinding in destruction of thread-locals
- cargo: asymmetric tokens
- cargo: reasons for rebuilding
- clippy: fix false negative in
needless_return
- clippy: fix
match_single_binding
suggestion introducing an extra semicolon - clippy: move
mutex_atomic
torestriction
- rust-analyzer: derive
Hash
- rust-analyzer: enum variant discriminants hints
- rust-analyzer: diagnose private assoc item accesses
- rust-analyzer: diagnose private field accesses
- rust-analyzer: implement yeeting
- rust-analyzer: fall back to inaccessible associated functions and constants if no visible resolutions are found
- rust-analyzer: improve exit point highlighting for
for
andwhile
loops in tail position - rust-analyzer: merge multiple intersecting ranges
- rust-analyzer: prefix prelude items whose name collides in current scope
- rust-analyzer: type check unstable
try{}
blocks - rust-analyzer: support multi-character punct tokens in MBE
- rust-analyzer: write down adjustments introduced by binary operators
Rust Compiler Performance Triage
Fairly busy week with some massive performance improvements at the expense of some significant albeit smaller regressions. The main wins came in a long-standing PR from @cjgillot to enable encoding spans in metadata relative to their enclosing item. This causes more work in full compilation which causes some regressions up to 5% but can lead to very large wins in incremental compilation scenarios (up to ~70%). For example, the clap crate compiles 68% faster after a small 1 line change than it did previously.
Triage done by @rylev. Revision range: b38a6d..b43596
Summary:
(instructions:u) | mean | range | count |
---|---|---|---|
Regressions ❌ (primary) |
1.6% | [0.3%, 4.6%] | 97 |
Regressions ❌ (secondary) |
1.8% | [0.2%, 7.6%] | 60 |
Improvements ✅ (primary) |
-9.7% | [-68.7%, -0.2%] | 53 |
Improvements ✅ (secondary) |
-1.7% | [-15.3%, -0.1%] | 62 |
All ❌✅ (primary) | -2.4% | [-68.7%, 4.6%] | 150 |
1 Regressions, 1 Improvements, 4 Mixed; 1 of them in rollups 47 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] Only include stable lints in
rustdoc::all
group - [disposition: merge] Don't derive Debug for
OnceWith
&RepeatWith
- [disposition: merge] PhantomData layout guarantees
- [disposition: merge] Add O(1)
Vec -> VecDeque
conversion guarantee - [disposition: merge] Stabilize
::{core,std}::pin::pin!
- [disposition: merge] Stabilize
main_separator_str
- [disposition: merge] Loosen the bound on the Debug implementation of Weak.
New and Updated RFCs
- No New or Updated RFCs were created this week.
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:
- No RFCs issued a call for testing this week.
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-01-04 - 2023-02-01 🦀
Virtual
- 2023-01-04 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2023-01-04 | Virtual (Stuttgart, DE) | Rust Community Stuttgart
- 2023-01-05 | Virtual (Charlottesville, VA, US) | Charlottesville Rust Meetup
- 2023-01-10 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-01-11 | Virtual (Boulder, CO, US) | Boulder Elixir and Rust
- 2023-01-12 | Virtual (San Francisco, CA, US; Stockholm, SE; New York, NY US) | Microsoft Reactor San Francisco | Microsoft Reactor New York
- 2023-01-12 | Virtual (Nürnberg, DE) | Rust Nuremberg
- 2023-01-14 | Virtual | Rust GameDev
- 2023-01-16 | Virtual (San Francisco, CA, US; São Paulo, BR; New York, NY, US) | Microsoft Reactor San Francisco and Microsoft Reactor São Paulo and Microsoft Reactor New York
- 2023-01-17 | Virtual (Berlin, DE) | OpenTechSchool Berlin
- 2023-01-17 | Virtual (San Francisco, CA, US; São Paulo, BR, New York, NY, US) | Microsoft Reactor San Francisco and Microsoft Reactor São Paulo and Microsoft Reactor New York
- 2023-01-17 | Virtual (Washington, DC, US) | Rust DC
- 2023-01-18 | Virtual (San Francisco, CA, US; São Paulo, BR; New York, NY US) | Microsoft Reactor San Francisco and Microsoft Reactor São Paulo and Microsoft Reactor New York
- 2023-01-18 | Virtual (Vancouver, BC, CA) | Vancouver Rust
- 2023-01-26 | Virtual (Charlottesville, VA, US) | Charlottesville Rust Meetup
- 2023-01-31 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-02-01 | Virtual (Indianapolis, IN, US) | Indy Rust
Asia
- 2023-01-15 | Tokyo, JP | Tokyo Rust Meetup
Europe
- 2023-01-12 | Enschede, NL | Dutch Rust Meetup
- 2023-01-20 | Stuttgart, DE | Rust Community Stuttgart
- 2023-01-25 | Paris, FR | Rust Paris
North America
- 2023-01-05 | Lehi, UT, US | Utah Rust
- 2023-01-09 | Minneapolis, MN, US | Minneapolis Rust Meetup
- 2023-01-11 | Austin, TX, US | Rust ATX
- 2023-01-17 | San Francisco, CA, US | San Francisco Rust Study Group
- 2023-01-26 | Copenhagen, DK | Copenhagen Rust group
- 2023-01-26 | Lehi, UT, US | Utah Rust
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
You haven’t “fooled” rustc, you are using unsafe code. Unsafe code means that all you can do is fool yourself.
– Frank Steffahn on rust-users
Thanks to Quine Dot 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