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 and archives can be viewed at this-week-in-rust.org. If you find any errors in this week's issue, please submit a PR.
Updates from Rust Community
Official
Project/Tooling Updates
- Unimock 0.6: Mutation patterns
- cargo-autoinherit: DRY up your workspace dependencies
- rust-analyzer changelog #226
- reqwest v0.12
- Fornjot v0.49.0 released - open source b-rep CAD kernel in Rust
- Quickwit 0.8: Indexing and Search at Petabyte Scale
Observations/Thoughts
- Why choose async/await over threads?
- Rustls: Continuous Benchmarking Case Study
- How I reduced (incremental) Rust compile times by up to 40%
- How I learned to stop worrying and love the global state
- On Tech Debt: My Rust Library is now a CDO
- How to use Rust on Debian (and Ubuntu, etc.)
- [audio] Hyper 1.0 with Sean McArthur
- [video] The magic of Rust's type system
Rust Walkthroughs
- Safe and Secure Coding in Rust: A Comparative Analysis of Rust and C/C++
- It's a library AND a binary
- Everything you need to know about testing in Rust
- Building a Notification Service in Rust with AWS SNS
- Embedded Rust Bluetooth on ESP: BLE Server
- [series] How Meilisearch Updates a Millions Vector Embeddings Database in Under a Minute
- [video] Extreme Clippy for a new Crate
Miscellaneous
- Making Nix Usable With Rust
- Rust Development Classes: learn Rust by doing
- Restarting development of the Rust Digger: 20,000 new crates in 8 months
Crate of the Week
This week's crate is coffee_break, the premier crate for those who think Rust compile times are too fast.
Thanks to Jonas Fassbender for the suggestion!
Please submit your suggestions and votes for next 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 calls for testing were issued 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.
Call for Participation; projects and speakers
CFP - Projects
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.
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Braintree
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Fiserv
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Globepay
- Rama — add Form support (IntroResponse + FromRequest)
- Rama — Provide “and(matcher)” and “or(matcher)” methods to enum matchers
- Rama — Provide support for boxed custom matchers in layer enums
- Rama — add open-telemetry middleware and extended prometheus support
- diesel - Review Diesel compile time error message
If you are a Rust project owner and are looking for contributors, please submit tasks here.
CFP - Speakers
Are you a new or experienced speaker looking for a place to share something cool? This section highlights events that are being planned and are accepting submissions to join their event as a speaker.
- RustFest Zürich 2024 | Closes 2024-03-31 | Zürich, Switzerland | Event date: 2024-06-19 - 2024-06-24
- RustConf 2024 | Closes 2024-04-25 | Montreal, Canada | Event date: 2024-09-10
- EuroRust 2024| Closes 2024-06-03 | Vienna, Austria & online | Event on 2024-10-10
- Scientific Computing in Rust 2024| Closes 2024-06-14 | online | Event date: 2024-07-17 - 2024-07-19
If you are an event organizer hoping to expand the reach of your event, please submit a link to the submission website through a PR to TWiR.
Updates from the Rust Project
444 pull requests were merged in the last week
- CFI: handle dyn with no principal
- CFI: strip auto traits off Virtual calls
- CFI: support
self_cell-likerecursion - CFI: support complex receivers
- add a never type option to make diverging blocks
() - add panic location to 'panicked while processing panic'
- change
only_localto aenumtype - compiler: allow transmute of ZST arrays with generics
- conditionally ignore fatal diagnostic in the SilentEmitter
- delegation: fix ICE on
bound_varsdivergence - deref patterns: bare-bones feature gate and typechecking
- implement macro-based
deref!()syntax for deref patterns - do not use
?-induced skewing of type inference in the compiler - don't ICE when encountering bound regions in generator interior type
- don't emit an error about failing to produce a file with a specific name if user never gave an explicit name
- don't trigger
unused_qualificationson global paths - encode implied predicates for traits
- ensure nested statics have a HIR node to prevent various queries from ICEing
- ensure stack before parsing dot-or-call
- experimental feature postfix match
- extend format arg help for simple tuple index access expression
- fix bad span for explicit lifetime suggestions
- fix incorrect mutable suggestion information for binding in ref pattern
- fix validation on substituted callee bodies in MIR inliner
- fixed the
private-dependencybug - gracefully handle
AnonConstindiagnostic_hir_wf_check() - handle str literals written with
'lexed as lifetime - ignore paths from expansion in
unused_qualifications - implement
FusedIteratorforgenblock - in
pretty_print_type(), print async fn futures' paths instead of spans - inherit
RUSTC_BOOTSTRAPwhen testing wasm - let codegen decide when to
mem::swapwith immediates - make
#[diagnostic::on_unimplemented]format string parsing more robust - make
type_ascribe!not a built-in - move
--sysrootargument out of the argument file to fix miri issue - move more intrinsics to
rustc_intrinsic - note that the caller chooses a type for type param
- prevent opaque types being instantiated twice with different regions within the same function
- print a backtrace in const eval if interrupted
- provide structured suggestion for unconstrained generic constant
- recursively evaluate the constants in everything that is 'mentioned'
- replace closures with
_when suggesting fully qualified path for method call - replace visibility test with reachability test in dead code detection
- split an item bounds and an item's super predicates
- split out
PredicatePolarityfromImplPolarity - strip placeholders from hidden types before remapping generic parameter
- suggest
RUST_MIN_STACKworkaround on overflow - suggest
_for missing generic arguments in turbofish - track run-make-support lib in common inputs stamp
- unbox and unwrap the contents of
StatementKind::Coverage - uniquify
ReErroron input mode in canonicalizer - use MSVC-style escaping when passing a response/@ file to lld on windows
- use
chunk_bywhen buildingReverseSccGraph - validate that we're only matching on unit
structfor path pattern - miri:
phase_rustdoc: add a heuristic to make us more certain that this is really rustdoc - miri: add support for missing SIMD float intrinsics
- miri: allow
llvm.x86.sse2.pauseinstrinsic to be called without SSE2 - miri: many-seeds: propagate failure properly
- miri: report retags as distinct from real memory accesses for data races
- stop sorting via
DefIds in region resolution - select
Vec::from_iterimpls in a const block to optimize compile times - stabilize
slice_split_at_unchecked - import the 2021 prelude in the core crate
- relax
SeqCstordering in standard library std::net: adding acceptfilter feature for netbsd/freebsdstd::thread: refineavailable_parallelismfor solaris/illumos- fix OOB pointer formed in
Vec::index - add
NonNull::<[T]>::is_empty - regex: add Cow guarantee to replace API
- cargo alias: dont panic when resolving an empty alias
- cargo testsuite: Rename lints to
lints_table - cargo toml: Expose surce/spans for VirtualManifests
- cargo toml: Push diagnostic complexity on annotate-snippets
- cargo vendor: tiny not important refactors
- cargo: do not strip debuginfo by default for MSVC
- cargo: add a basic linting system
- cargo: report some dependency changes on any command
- cargo: fix debuginfo strip when using
--target - cargo: fix doc collision for lib/bin with a dash in the inferred name
- cargo: fix publish script due to crates.io CDN change
- cargo: do not borrow shell across registry query
- cargo: warn on -Zlints
- cargo: refactor: make lint names
snake_case - cargo: use
gitoxideforlist_files_git - bindgen: allow custom derives on new-type alias
- bindgen: make
CargoCallbacksmore discoverable - bindgen: move phantom fields to start of
structto avoid interfering with flexible array members - clippy:
assigning_clonesshould respect MSRV - clippy:
let_and_return: avoid linting when code between last stmt and return expr is cfg'd out - clippy:
manual_assert: do not add extra semicolon - clippy:
useless_asref: do not lint.as_ref().map(Arc::clone) - clippy: add
missing_transmute_annotationslint - clippy: add necessary parentheses to
manual_unwrap_or_defaultlint output - clippy: change applicability of
assigning_clonestoUnspecified - clippy: correct version for
incompatible_msrv - clippy: disable
cast_losslesswhen casting to u128 from any (u)int type - clippy: do not warn on
.map(_::clone)forArc,Rc, and their weak variants - clippy: don't lint
mixed_attributes_stylewhen mixing docs and other attrs - clippy: enable
unused_qualificationslint - clippy: fix infinite loop in
cast_sign_losswhen peeling unwrap method calls - clippy: fix
suspicious_else_formattingfalse positive when else is included … - clippy: make
assigning_clonesMSRV check more precise - clippy: remove
unwrapfrommatch_trait_method - rust-analyzer: add fuel to match checking
- rust-analyzer: limit
structhover display nums - rust-analyzer: don't assert paths being utf8 when filtering them in the watcher
- rust-analyzer: fix project discovery not checking whether the
Cargo.tomlactually exists - rust-analyzer: fix projects depending on
rustc_privatehanging - rust-analyzer: goto implementation to impls inside blocks
- rust-analyzer: handle
self::superwhen lowering UseTree - rust-analyzer: improve error recovery for match arms
- rust-analyzer: keep the span for
Attr::Literalaround - rust-analyzer: prevent stack overflow in recursive const types
- rust-analyzer: rename
func_liketoFuncLike - rust-analyzer: some file watching related vfs fixes
- rust-analyzer: handle panicking like rustc CTFE does
- rust-analyzer: have Derive Attribute share a token tree with it's proc macros
- rust-analyzer: resolve whether
$patis$pat_paramor not via 🌟hygiene🌟
Rust Compiler Performance Triage
An overall fairly quiet week with the unfortunate one exception of large instruction count and binary size regressions caused by changes in const evaluation. This was largely balanced out (at least in instruction count) by a group of small improvements, but the compiler did end up 0.2% slower on average across 97 benchmarks.
Triage done by @rylev. Revision range: 21d94a3..73476d
Summary:
| (instructions:u) | mean | range | count |
|---|---|---|---|
| Regressions ❌ (primary) |
1.0% | [0.2%, 3.2%] | 56 |
| Regressions ❌ (secondary) |
0.6% | [0.1%, 1.9%] | 38 |
| Improvements ✅ (primary) |
-0.8% | [-1.5%, -0.2%] | 41 |
| Improvements ✅ (secondary) |
-1.2% | [-5.2%, -0.4%] | 13 |
| All ❌✅ (primary) | 0.2% | [-1.5%, 3.2%] | 97 |
4 Regressions, 6 Improvements, 2 Mixed; 4 of them in rollups 63 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
- [disposition: merge] unsafe attributes
Tracking Issues & PRs
Rust
- [disposition: merge] Eagerly instantiate closure/coroutine-like bounds with placeholders to deal with binders correctly
- [disposition: merge] Tracking Issue for
Literal::byte_character - [disposition: merge] Tracking Issue for
proc_macro_c_str_literals - [disposition: merge] Tracking Issue for const_caller_location
- [disposition: merge] Make inductive cycles always ambiguous
- [disposition: merge] Add
REDUNDANT_LIFETIMESlint to detect lifetimes which are semantically redundant
New and Updated RFCs
- [new] Move the Crates.io Team under the Dev Tools team
- [new] RFC: Add realign_stack attribute to rustc
- [new, disposition: merge] RFC: Reserve unprefixed guarded string literals in Edition 2024
Upcoming Events
Rusty Events between 2024-03-27 - 2024-04-24 🦀
Virtual
- 2024-03-28 | Virtual + In Person (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-04-02 | Virtual (Buffalo, NY, US) | Buffalo Rust
- 2024-04-03 | Virtual (Cardiff, UK) | Rust and C++ Cardiff
- 2024-04-03 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2024-04-04 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-04-09 | Virtual (Dallas, TX, US) | Dallas Rust
- 2024-04-11 | Virtual + In Person (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-04-11 | Virtual (Nürnberg, DE) | Rust Nüremberg
- 2024-04-16 | Virtual (Washinigton, DC, US) | Rust DC
- 2024-04-17 | Virtual (Vancouver, BC, CA) | Vancouver Rust
- 2024-04-18 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
Africa
- 2024-04-05 | Kampala, UG | Rust Circle Kampala
Asia
- 2024-03-30 | New Delhi, IN | Rust Delhi
Europe
- 2024-03-27 & 2024-03-28 | London, UK | Rust Nation UK
- 2024-03-28 | Berlin, DE | Rust Berlin
- 2024-04-10 | Manchester, UK | Manchseter Rust Meetup
- 2024-04-10 | Cambridge, UK | Cambridge Rust Meetup
- 2024-04-10 | Manchester, UK | Rust Manchester
- 2024-04-10 | Oslo, NO | Rust Oslo
- 2024-04-11 | Bordeaux, FR | Rust Bordeaux
- 2024-04-11 | Reading, UK | Reading Rust Workshop
- 2024-04-15 | Zagreb, HR | impl Zagreb for Rust
- 2024-04-16 | Bratislava, SK | Bratislava Rust Meetup Group
- 2024-04-16 | Leipzig, DE | Rust - Modern Systems Programming in Leipzig
- 2024-04-16 | Munich, DE + Virtual | Rust Munich
- 2024-04-17 | Bergen, NO | Hubbel kodeklubb
North America
- 2024-03-27 | Austin, TX, US | Rust ATX
- 2024-03-27 | Hawthorne (Los Angeles), CA, US | Freeform
- 2024-03-31 | Boston, MA, US | Boston Rust Meetup
- 2024-04-04 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-04-04 | Portland, OR, US | PDXRust Meetup
- 2024-04-10 | Boulder, CO, US | Boulder Rust Meetup
- 2024-04-11 | Seattle, WA, US | Seattle Rust User Group
- 2024-04-11 | Spokane, WA, US | Spokane Rust
- 2024-04-16 | San Francisco, CA, US | San Francisco Rust Study Group
- 2024-04-16 | Seattle, WA, US | Seattle Rust User Group
- 2024-04-18 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-04-24 | Austin, TX, US | Rust ATX
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
"Top contributor" is not a place of glory, it should go to a bot because people should work at a sustainable pace and prioritize touching grass every once in a while. If a person ever works harder than bors, that's a problem!
– Carol (Nichols || Goulding) on rust-internals
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