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 X(formerly 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.
Want TWIR in your inbox? Subscribe here.
Updates from Rust Community
Newsletters
Project/Tooling Updates
- Maelstrom v0.10.0: A Hermetic, Fast, Clustered Test Runner: Added Support for Python Tests, Other Container Image Repositores, and more
- Rust for filesystems
- Bevy 0.14
- Introducing Avian Physics 0.1
- iroh 0.20.0
- Release Nutype 0.4.3
- Rerun 0.17 - better blueprints with defaults and overrides for any data
Observations/Thoughts
- Rustic Witcher: Reimagining data anonymization
- Memory Safety in C++ vs Rust vs Zig
- Using unsafe in our Rust interpreters: easy, debatably ethical performance
- How to configure CPU cores to be used in a Tokio application with core_affinity
- Further simplifying self-referential types for Rust
- Network Manager and Rust's zbus
- PyO3: From Python to Rust and Back Again
- Properly Testing Concurrent Data Structures
- A Unified Typesystem
Rust Walkthroughs
- Writing Production Rust Macros with
macro_rules!
- Mix in Rust
- Demystifying Rust's HTTP ecosystem: Here is how the different crates fit together
- Build with Naz : Rust async in practice tokio::select! & cancellation safety
Miscellaneous
- June 2024 Rust Jobs Report
- [video] Jan Hohenheim discusses Rust, Rust GameDev Newsletter & The Bevy Engine
Crate of the Week
This week's crate is derive_deftly, a proc macro to create derive macros from declarative code.
Thanks to duelafn for the suggestion!
Please submit your suggestions and votes for next week!
Calls 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:
RFCs
- No calls for testing were issued this week.
Rust
- No calls for testing were issued this week.
Rustup
- 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.
No Calls for participation were submitted this week.
If you are a Rust project owner and are looking for contributors, please submit tasks here or through a PR to TWiR or by reaching out on X (Formerly twitter) or Mastodon!
CFP - Events
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.
No Calls for papers or presentations were submitted this week.
If you are an event organizer hoping to expand the reach of your event, please submit a link to the website through a PR to TWiR or by reaching out on X (Formerly twitter) or Mastodon!
Updates from the Rust Project
469 pull requests were merged in the last week
- wasm64 build with target-feature=+simd128,+atomics
macro_metavar_expr_concat
Add support for literalsout_of_scope_macro_calls
: Detect calls inside attributes more precisely- actually report normalization-based type errors correctly for alias-relate obligations in new solver
- add
as_lang_item
toLanguageItems
, new trait solver - change
asm-comments
toverbose-asm
, always emit user comments - change return-type-notation to use
(..)
- check alias args for WF even if they have escaping bound vars
- coverage: extract hole spans from HIR instead of MIR
- coverage: rename
mir::coverage::BranchInfo
toCoverageInfoHi
- disable dead variant removal for
#[repr(C)]
enums - emit a wrap expr
span_bug
only if context is not tainted - fix
FnMut::call_mut
/Fn::call
shim for async closures that capture references - fix import suggestion error when path segment failed not from starting
- fix incorrect suggestion for extra argument with a type error
- fix intrinsic const parameter counting with
effects
- improve dead code analysis
- improve well known value check-cfg diagnostic for the standard library
- infer async closure signature from (old-style) two-part
Fn
+Future
bounds - linker: link dylib crates by path
- make
FloatTy
checks exhaustive in pretty print - make
NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE
a deny-by-default lint in edition 2024 - make
can_eq
process obligations (almost) everywhere - make
push_outlives_components
into aTypeVisitor
- make casts of pointers to trait objects stricter
- match ergonomics 2024: Implement TC's match ergonomics proposal
- match ergonomics 2024: align with RFC again
- parenthesize break values containing leading label
- re-implement a type-size based limit
- remove a use of
StructuredDiag
, which is incompatible with automatic error tainting and error translations - remove global error count checks from typeck
- rewrite handling of universe-leaking placeholder regions into outlives constraints
- rustdoc-json: better representation of lifetime bounds in where clauses
- rustdoc-search: stop constructing pointless arrays in decode
- show fnsig's unit output explicitly when there is output diff in diagnostics
- stop using specialization in
rustc_index
andrustc_borrowck
- tweak
-1 as usize
suggestion - use
ControlFlow
results for visitors that are only looking for a single value - use
IndexVec
for coroutine local mapping - use field ident spans directly instead of the full field span in diagnostics on local fields
- use the aligned size for alloca at args/ret when the pass mode is cast
- tweak some structured suggestions to be more verbose and accurate
- use verbose style for argument removal suggestion
- use verbose suggestion for
ptr::null_mut()
- use verbose suggestion for changing arg type
- verify that allocations output by GVN are sufficiently aligned
- support tail calls in mir via
TerminatorKind::TailCall
- use the native unwind function in miri where possible
- miri function identity hack: account for possible inlining
- miri: TB: refine protector end semantics
- miri: add syscall
dup()
for unix target - miri: implement
libc::sched_setaffinity
on linux - miri: implement the
_mm256_zeroupper
and_mm256_zeroall
intrinsics - miri: stacked Borrows: fix PartialEq for Stack
- miri: use the
symbol_name
query instead of trying to infer from thelink_name
attribute - cache
hir_owner_nodes
in ParentHirIterator - cache type sizes in type-size limit visitor
- make jump threading state sparse
- stabilize
atomic_bool_fetch_not
- stabilize
hint::assert_unchecked
- add
new_range_api
for RFC #3550 - impl
PathBuf::add_extension
andPath::with_added_extension
- improve
std::Path's
Hash quality by avoiding prefix collisions - specialize
TrustedLen
forIterator::unzip()
- linkedList's Cursor: method to get a ref to the cursor's list
- mark format! with
must_use
hint - optimize SipHash by reordering compress instructions
- cargo: add rustdocflags to Unit's Debug impl
- cargo: allow enabling
config-include
feature in config - cargo: dont make new constant
InternedString
in hot path - cargo: fix
compatible_with_older_cargo
test - cargo: fix: improve message for inactive weak optional feature with edition2024 through unused dep collection
- cargo: pass rustflags to artifacts built with implicit targets when using target-applies-to-host
- bindgen: fix generated constants:
f64::INFINITY
&f64::NEG_INFINITY
- jsondocck: add
$FILE
built-in variable - jsondocck: use correct index for error message
- clippy:
almost_complete_range
: Delay suggestion creation - clippy:
doc_markdown
: detect escapedwhen checking unmatched
- clippy:
missing_const_for_fn
: fix FP when arg ty is impl trait alias ty - clippy:
missing_const_for_fn
: fix suggestions for fn with abi that requiresconst_extern_fn
feature - clippy:
needless_return
: Support#[expect]
on the return statement - clippy:
significant_drop_in_scrutinee
: Trigger lint also for scrutinees inwhile let
andif let
- clippy:
unnecessary_to_owned
: catchto_owned
on byte slice to create temporary&str
- clippy: add new lint
hashset_insert_after_contains
- clippy: add new lint for byte char slices
- clippy: add
cfg_not_test
lint - clippy: fix false positive with
into_iter_without_iter
- clippy: fix some false-positive cases of
explicit_auto_deref
- clippy: honor
avoid-breaking-exported-api
inneedless_pass_by_ref_mut
- clippy: only check for
automatically_derived
on impl blocks - clippy: refactor
disallowed_methods
and narrow span - clippy: rework
init_numbered_fields
- rust-analyzer: add
--keep-going
to the check command - rust-analyzer: add an option to use
"::"
for the external crate prefix - rust-analyzer: also mark
InferenceResult::has_errors
flag when there are error types - rust-analyzer: disallow nested impl traits
- rust-analyzer: don't emit semantic diagnostics in files with a lot of syntax errors
- rust-analyzer: fix callHierarchy LSP violation
- rust-analyzer: fix double rounding of
f32
literals - rust-analyzer: fix lifetime parameters moving parameter defaults
- rust-analyzer: fix parameter completions using macro expanded source ranges
- rust-analyzer: fix passing
message-format
after -- in debugging - rust-analyzer: fix runnables being incorrectly constructed
- rust-analyzer: fix up the syntax tree for macro 2.0
- rust-analyzer: skip match exhaustiveness checking if pattern type contains errors
- rust-analyzer: move lifetimes in front of type and const params but after self
- rust-analyzer: remove version check before using
--keep-going
Rust Compiler Performance Triage
More regressions than improvements this week, caused by a combination of fixes, refactorings, third-party dependency updates and in general the compiler doing slightly more work.
Triage done by @kobzol. Revision range: cf2df68d..a2d58197
Summary:
(instructions:u) | mean | range | count |
---|---|---|---|
Regressions ❌ (primary) |
0.7% | [0.2%, 2.5%] | 53 |
Regressions ❌ (secondary) |
1.0% | [0.4%, 1.5%] | 31 |
Improvements ✅ (primary) |
-0.6% | [-1.2%, -0.2%] | 10 |
Improvements ✅ (secondary) |
-1.7% | [-2.4%, -1.4%] | 4 |
All ❌✅ (primary) | 0.5% | [-1.2%, 2.5%] | 63 |
1 Regression, 2 Improvements, 7 Mixed; 3 of them in rollups 62 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]
repr(discriminant = ...)
for type aliases - [disposition: merge] Match ergonomics 2024
Tracking Issues & PRs
Rust
- [disposition: merge] Tracking Issue for Missing BMI1, AVX2, SSE2, SSE4.1, SSE4a and TBM intrinsics
- [disposition: merge] offset_from: always allow pointers to point to the same address
- [disposition: merge] Fix ambiguous cases of multiple & in elided self lifetimes
- [disposition: merge] Tracking issue for RFC 2351, "Add is_sorted to the standard library"
- [disposition: merge] Tracking issue for io_slice_advance
- [disposition: merge] Tracking Issue for
const_waker
Cargo
- No Cargo Tracking Issues or PRs entered Final Comment Period this week.
Language Team
- No Language Team Tracking Issues or PRs entered Final Comment Period this week.
Language Reference
- [disposition: (unspecified)] elaborate on slice wide pointer metadata
Unsafe Code Guidelines
- No Unsafe Code Guideline Tracking Issues or PRs entered Final Comment Period this week.
New and Updated RFCs
Upcoming Events
Rusty Events between 2024-07-10 - 2024-08-07 🦀
Virtual
- 2024-07-10 | Virtual | Centre for eResearch
- 2024-07-11 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-07-11 | Hybrid - Virtual and In-person (Mexico City, DF, MX) | Rust MX
- 2024-07-11 | Virtual (Nürnberg, DE) | Rust Nuremberg
- 2024-07-11 | Virtual (Tel Aviv, IL) | Code Mavens
- 2024-07-11 | Virtual (IL) | Rust in Israel
- 2024-07-17 | Hybrid - Virtual and In-person (Vancouver, BC, CA) | Vancouver Rust
- 2024-07-18 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-07-23 | Hybrid - Virtual and In-Person (München/Munich, DE) | Rust Munich
- 2024-07-24 | Virtual | Women in Rust
- 2024-07-25 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-07-27 | Hybrid - Virtual and In-Person (Kyiv, UA) | UA Rust
- 2024-07-27 | Virtual | Leptos Monthly Meetup
- 2024-07-30 | Virtual (Dallas, TX, US) | Dallas Rust
- 2024-07-31 | Virtual (Tel Aviv, IL) | Code Mavens
- 2024-08-01 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-08-06 | Virtual | Women in Rust
- 2024-08-06 | Virtual (Buffalo, NY, US) | Buffalo Rust Meetup
- 2024-08-06 | Virtual (Tel Aviv, IL) | Code Mavens
- 2024-08-07 | Virtual (Indianapolis, IN, US) | Indy Rust
Africa
- 2024-08-02 | Kampala, UG | Rust Circle Kampala
Asia
- 2024-07-20 | Bangalore/Bengaluru, IN | Rust Bangalore
Europe
- 2024-07-10 | Reading, UK | Reading Rust Workshop
- 2024-07-11 | Prague, CZ | Rust Prague
- 2024-07-16 | Leipzig, DE | Rust - Modern Systems Programming in Leipzig
- 2024-07-16 | Mannheim, DE | Hackschool - Rhein-Neckar
- 2024-07-18 | Bern, CH | Rust Bern
- 2024-07-23 | Hybrid - Virtual and In-Person (München/Munich, DE) | Rust Munich
- 2024-07-25 | Augsburg, DE | Rust Meetup Augsburg
- 2024-07-25 | Berlin, DE | OpenTechSchool Berlin + Rust Berlin
- 2024-07-27 | Hybrid - Virtual and In-Person (Kyiv, UA) | UA Rust
- 2024-07-30 | Basel, CH | Rust Basel
North America
- 2024-07-11 | Hybrid - Mexico City, DF, MX | Rust MX
- 2024-07-11 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-07-13 | Cambridge, MA, US | Boston Rust Meetup
- 2024-07-17 | Hybrid - Vancouver, BC, CA | Vancouver Rust
- 2024-07-18 | Nashville, TN, US | Music City Rust Developers
- 2024-07-18 | Seattle, WA, US | Seattle Rust User Group
- 2024-07-21 | Boston, MA, US | Boston Rust Meetup
- 2024-07-24 | Austin, TX, US | Rust ATC
- 2024-07-25 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-07-29 | Cambridge, MA, US| Boston Rust Meetup
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
In Rust, the preferred solution is to avoid the need for such document to exist.
– Kornel on rust-users replying to a question about Rust code guidelines
Thanks to Chayim Refael Friedman 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