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
- zbus 4.0 released. zbus is a pure Rust D-Bus crate. The new version brings a more ergonomic and safer API. Release: zbus4
- This Month in Rust OSDev: January 2024
- Rerun 0.13 - real-time kHz time series in a multimodal visualizer
- egui 0.26 - Text selection in labels
- Hello, Selium! Yet another streaming platform, but easier
Observations/Thoughts
- Which red is your function?
- Porting libyaml to Safe Rust: Some Thoughts
- Design safe collection API with compile-time reference stability in Rust
- Cross compiling Rust to win32
- Modular: Mojo vs. Rust: is Mojo 🔥 faster than Rust 🦀 ?
- Extending Rust's Effect System
- Allocation-free decoding with traits and high-ranked trait bounds
- Cross-Compiling Your Project in Rust
- Kind: Our Rust library that provides zero-cost, type-safe identifiers
- Performance Roulette: The Luck of Code Alignment
- Too dangerous for C++
- Building an Uptime Monitor in Rust
- Box Plots at the Olympics
- Rust in Production: Interview with FOSSA
- Performance Pitfalls of Async Function Pointers (and Why It Might Not Matter)
- Error management in Rust, and libs that support it
- Finishing Turborepo's migration from Go to Rust
- Rust: Reading a file line by line while being mindful of RAM usage
- Why Rust? It's the safe choice
- [video] Rust 1.76.0: 73 highlights in 24 minutes!
Rust Walkthroughs
- Rust/C++ Interop Part 1 - Just the Basics
- Rust/C++ Interop Part 2 - CMake
- Speeding up data analysis with Rayon and Rust
- Calling Rust FFI libraries from Go
- Write a simple TCP chat server in Rust
- [video] Google Oauth with GraphQL API written in Rust - part 1. Registration mutation.
Miscellaneous
- The book "Asynchronous Programming in Rust" is released
- January 2024 Rust Jobs Report
- Chasing a bug in a SAT solver
- Rust for hardware vendors
- [audio] How To Secure Your Audio Code Using Rust With Chase Kanipe
- [audio] Tweede Golf - Rust in Production Podcast
- [video] RustConf 2023
- [video] Decrusting the tracing crate
Crate of the Week
This week's crate is microflow, a robust and efficient TinyML inference engine for embedded systems.
Thanks to matteocarnelos for the self-suggestion!
Please submit your suggestions and votes for next week!
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 - [FEATURE]: Setup code coverage for local tests & CI
- Hyperswitch - [FEATURE]: Have get_required_value to use ValidationError in OptionExt
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.
- Devoxx PL 2024 | CFP closes 2024-03-01 | Krakow, Poland | Event date: 2024-06-19 - 2024-06-21
- RustFest Zürich 2024 CFP closes 2024-03-31 | Zürich, Switzerland | Event date: 2024-06-19 - 2024-06-24
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
466 pull requests were merged in the last week
- add armv8r-none-eabihf target for the Cortex-R52
- add lahfsahf and prfchw target feature
check_consts
: fix duplicate errors, make importance consistentinterpret/write_discriminant
: when encoding niched variant, ensure the stored value matcheslarge_assignments
: Allow moves into functionspattern_analysis
: gather up place-relevant infopattern_analysis
: track usefulness without interior mutability- account for non-overlapping unmet trait bounds in suggestion
- account for unbounded type param receiver in suggestions
- add support for custom JSON targets when using build-std
- add unstable
-Z direct-access-external-data
cmdline flag forrustc
- allow restricted trait impls under
#[allow_internal_unstable(min_specialization)]
- always check the result of
pthread_mutex_lock
- avoid ICE in drop recursion check in case of invalid drop impls
- avoid a collection and iteration on empty passes
- avoid accessing the HIR in the happy path of
coherent_trait
- bail out of drop elaboration when encountering error types
- build DebugInfo for async closures
- check that the ABI of the instance we are inlining is correct
- clean inlined type alias with correct param-env
- continue to borrowck even if there were previous errors
- coverage: split out counter increment sites from BCB node/edge counters
- create
try_new
function for ThinBox - deduplicate
tcx.instance_mir(instance)
calls intry_instance_mir
- don't expect early-bound region to be local when reporting errors in RPITIT well-formedness
- don't skip coercions for types with errors
- emit a diagnostic for invalid target options
- emit more specific diagnostics when enums fail to cast with
as
- encode
coroutine_for_closure
for foreign crates - exhaustiveness: prefer "
0..MAX
not covered" to "_
not covered" - fix ICE for deref coercions with type errors
- fix
ErrorGuaranteed
unsoundness with stash/steal - fix cycle error when a static and a promoted are mutually recursive
- fix more
ty::Error
ICEs in MIR passes - for E0223, suggest associated functions that are similar to the path
- for a rigid projection, recursively look at the self type's item bounds to fix the
associated_type_bounds
feature - gracefully handle non-WF alias in
assemble_alias_bound_candidates_recur
- harmonize
AsyncFn
implementations, make async closures conditionally implFn*
traits - hide impls if trait bound is proven from env
- hir: make sure all
HirId
s have corresponding HIR Nodes
- improve 'generic param from outer item' error for
Self
and insidestatic
/const
items - improve normalization of
Pointee::Metadata
- improve pretty printing for associated items in trait objects
- introduce
enter_forall
to supercedeinstantiate_binder_with_placeholders
- lowering unnamed fields and anonymous adt
- make
min_exhaustive_patterns
matchexhaustive_patterns
better - make it so that async-fn-in-trait is compatible with a concrete future in implementation
- make privacy visitor use types more (instead of HIR)
- make traits / trait methods detected by the dead code lint
- mark "unused binding" suggestion as maybe incorrect
- match lowering: consistently lower bindings deepest-first
- merge
impl_polarity
andimpl_trait_ref
queries - more internal emit diagnostics cleanups
- move path implementations into
sys
- normalize type outlives obligations in NLL for new solver
- print image input file and checksum in CI only
- print kind of coroutine closure
- properly handle
async
block andasync fn
inif
exprs withoutelse
- provide more suggestions on invalid equality where bounds
- record coroutine kind in coroutine generics
- remove some
unchecked_claim_error_was_emitted
calls - resolve: unload speculatively resolved crates before freezing cstore
- rework support for async closures; allow them to return futures that borrow from the closure's captures
- static mut: allow mutable reference to arbitrary types, not just slices and arrays
- stop bailing out from compilation just because there were incoherent traits
- suggest
[tail @ ..]
on[..tail]
and[...tail]
wheretail
is unresolved - suggest less bug-prone construction of Duration in docs
- suggest name value cfg when only value is used for check-cfg
- suggest pattern tests when modifying exhaustiveness
- suggest turning
if let
into irrefutablelet
if appropriate - suppress suggestions in derive macro
- take empty
where
bounds into account when suggesting predicates - toggle
assert_unsafe_precondition
in codegen instead of expansion - turn the "no saved object file in work product" ICE into a translatable fatal error
- warn on references casting to bigger memory layout
- unstably allow constants to refer to statics and read from immutable statics
- use the same mir-opt bless targets on all platforms
- enable MIR JumpThreading by default
- fix mir pass ICE in the presence of other errors
- miri: fix ICE with symbolic alignment check on extern static
- miri: implement the
mmap64
foreign item - prevent running some code if it is already in the map
- A trait's local impls are trivially coherent if there are no impls
- use
ensure
when the result of the query is not needed beyond itsResult
ness - implement SystemTime for UEFI
- implement sys/thread for UEFI
- core/time: avoid divisions in
Duration::new
- core: add Duration constructors
- make
NonZero
constructors generic - reconstify
Add
- replace pthread
RwLock
with custom implementation - simd intrinsics: add
simd_shuffle_generic
and other missing intrinsics - cargo: test-support: remove special case for
$message_type
- cargo: don't add the new package to workspace.members if there is no existing workspace in Cargo.toml
- cargo: enable edition migration for 2024
- cargo: feat: add hint for adding members to workspace
- cargo: fix confusing error messages for sparse index replaced source
- cargo: fix: don't duplicate comments when editing TOML
- cargo: relax a test to permit warnings to be emitted, too
- rustdoc: Correctly generate path for non-local items in source code pages
- bindgen: add target mappings for
riscv64imac
andriscv32imafc
- bindgen: feat: add
headers
option - clippy:
mem_replace_with_default
No longer triggers on unused expression - clippy:
similar_names
: don't raise if the first character is different - clippy:
to_string_trait_impl
: avoid linting if the impl is a specialization - clippy:
unconditional_recursion
: compare byTy
s instead of DefIds
- clippy: don't allow derive macros to silence
disallowed_macros
- clippy: don't lint
incompatible_msrv
in test code - clippy: extend
NONMINIMAL_BOOL
lint - clippy: fix broken URL in
Lint Configuration
- clippy: fix false positive in
redundant_type_annotations
lint - clippy: add autofixes for
unnecessary_fallible_conversions
- clippy: fix: ICE when array index exceeds usize
- clippy: refactor
implied_bounds_in_impls
lint - clippy: return
Some
fromwalk_to_expr_usage
more - clippy: stop linting
blocks_in_conditions
onmatch
with weird attr macro case - rust-analyzer: abstract more over ItemTreeLoc-like structs
- rust-analyzer: better error message for when proc-macros have not yet been built
- rust-analyzer: add "unnecessary else" diagnostic and fix
- rust-analyzer: add break and return postfix keyword completions
- rust-analyzer: add diagnostic with fix to replace trailing
return <val>;
with<val>
- rust-analyzer: add incorrect case diagnostics for traits and their associated items
- rust-analyzer: allow cargo check to run on only the current package
- rust-analyzer: completion list suggests constructor like & builder methods first
- rust-analyzer: improve support for ignored proc macros
- rust-analyzer: introduce term search to rust-analyzer
- rust-analyzer: create
UnindexedProject
notification to be sent to the client - rust-analyzer: substitute
$saved_file
in custom check commands - rust-analyzer: fix incorrect inlining of functions that come from MBE macros
- rust-analyzer:
waker_getters
tracking issue from 87021 for 96992 - rust-analyzer: fix macro transcriber emitting incorrect lifetime tokens
- rust-analyzer: fix target layout fetching
- rust-analyzer: fix tuple structs not rendering visibility in their fields
- rust-analyzer: highlight rustdoc
- rust-analyzer: preserve where clause when builtin derive
- rust-analyzer: recover from missing argument in call expressions
- rust-analyzer: remove unnecessary
.as_ref()
in generate getter assist - rust-analyzer: validate literals in proc-macro-srv
FreeFunctions::literal_from_str
- rust-analyzer: implement
literal_from_str
for proc macro server - rust-analyzer: implement convert to guarded return assist for
let
statement with type that implementsstd::ops::Try
Rust Compiler Performance Triage
Relatively balanced results this week, with more improvements than regressions. Some of the
larger regressions are not relevant, however there was a real large regression on doc
builds, that was
caused by a correctness fix (rustdoc
was doing the wrong thing before).
Triage done by @kobzol. Revision range: 0984becf..74c3f5a1
Summary:
(instructions:u) | mean | range | count |
---|---|---|---|
Regressions ❌ (primary) |
2.1% | [0.2%, 12.0%] | 44 |
Regressions ❌ (secondary) |
5.2% | [0.2%, 20.1%] | 76 |
Improvements ✅ (primary) |
-0.7% | [-2.4%, -0.2%] | 139 |
Improvements ✅ (secondary) |
-1.3% | [-3.3%, -0.3%] | 86 |
All ❌✅ (primary) | -0.1% | [-2.4%, 12.0%] | 183 |
6 Regressions, 5 Improvements, 8 Mixed; 5 of them in rollups 53 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:
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
Tracking Issues & PRs
Rust
- [disposition: close] Implement
Future
forOption<F>
- [disposition: merge] Tracking Issue for min_exhaustive_patterns
- [disposition: merge] Make unsafe_op_in_unsafe_fn warn-by-default starting in 2024 edition
Cargo
- [disposition: merge] feat: respect rust-version when generating lockfile
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:
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 2024-02-14 - 2024-03-13 💕 🦀 💕
Virtual
- 2024-02-15 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-02-15 | Virtual + In person (Praha, CZ) | Rust Czech Republic
- 2024-02-19 | Virtual (Melbourne, VIC, AU)| Rust Melbourne
- 2024-02-20 | Virtual (Melbourne, VIC, AU) | Rust Melbourne
- 2024-02-20 | Virtual (Washington, DC, US) | Rust DC
- 2024-02-20 | Virtual | Rust for Lunch
- 2024-02-21 | Virtual (Cardiff, UK) | Rust and C++ Cardiff
- 2024-02-21 | Virtual (Vancouver, BC, CA) | Vancouver Rust
- 2024-02-22 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-02-27 | Virtual (Dallas, TX, US) | Dallas Rust
- 2024-02-29 | Virtual (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-02-29 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-03-06 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2024-03-07 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-03-12 | Virtual (Dallas, TX, US) | Dallas Rust
- 2024-03-12 | Hybrid (Virtual + In-person) Munich, DE | Rust Munich
Asia
- 2024-02-17 | New Delhi, IN | Rust Delhi
Europe
- 2024-02-15 | Copenhagen, DK | Copenhagen Rust Community
- 2024-02-15 | Praha, CZ - Virtual + In-person | Rust Czech Republic
- 2024-02-21 | Lyon, FR | Rust Lyon
- 2024-02-22 | Aarhus, DK | Rust Aarhus
- 2024-02-29 | Berlin, DE | Rust Berlin
- 2024-03-12 | Munich, DE + Virtual | Rust Munich
North America
- 2024-02-15 | Boston, MA, US | Boston Rust Meetup
- 2024-02-15 | Seattle, WA, US | Seattle Rust User Group
- 2024-02-20 | New York, NY, US | Rust NYC
- 2024-02-20 | San Francisco, CA, US | San Francisco Rust Study Group
- 2024-02-21 | Boston, MA, US | Boston Rust Meetup
- 2024-02-22 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-02-28 | Austin, TX, US | Rust ATX
- 2024-03-07 | Mountain View, CA, US | Mountain View Rust Meetup
Oceania
- 2024-02-19 | Melbourne, VIC, AU + Virtual | Rust Melbourne
- 2024-02-20 | Melbourne, VIC, AU + Virtual | Rust Melbourne
- 2024-02-27 | Canberra, ACT, AU | Canberra Rust User Group
- 2024-02-27 | Sydney, NSW, AU | Rust Sydney
- 2024-03-05 | Auckland, NZ | Rust AKL
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
For some weird reason the Elixir Discord community has a distinct lack of programmer-socks-wearing queer furries, at least compared to Rust, or even most other tech-y Discord servers I’ve seen. It caused some weird cognitive dissonance. Why do I feel vaguely strange hanging out online with all these kind, knowledgeable, friendly and compassionate techbro’s? Then I see a name I recognized from elsewhere and my hindbrain goes “oh thank gods, I know for a fact she’s actually a snow leopard in her free time”. Okay, this nitpick is firmly tongue-in-cheek, but the Rust user-base continues to be a fascinating case study in how many weirdos you can get together in one place when you very explicitly say it’s ok to be a weirdo.
– SimonHeath on the alopex Wiki's ElixirNitpicks page
Thanks to Brian Kung 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