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
Newsletters
Project/Tooling Updates
- Dioxus 0.5: Signal Rewrite, Remove lifetimes, CSS Hotreloading, and more!
- EtherCrab 0.4.0: Pure Rust EtherCAT, now with Distributed Clocks
- nethsm 0.1.0 - first release for this high level library for the Nitrokey NetHSM
- BugStalker v0.1.3 released - first release of rust debugger
- git-cliff 2.2.0 is released! (highly customizable changelog generator)
Observations/Thoughts
- On Reusing Arc and Rc in Rust
- Who killed the network switch?
- Xr0 Makes C Safer than Rust
- Easy Mode Rust
- Bashing Bevy To Bait Internet Strangers Into Improving My Code
- Conway's Game of Life Through Time
- Functions Everywhere, Only Once: Writing Functions for the Everywhere Computer
- Rust Bytes: Is Rust the Future of JavaScript Tooling?
- Explaining the internals of async-task from the ground up
- Programming ESP32 with Rust: OTA firmware update
- Fast Development In Rust, Part 2
Rust Walkthroughs
- Modelling Universal Domain Types in Rust
- [video] developerlife.com - Get started with unit testing in Rust
Research
Miscellaneous
- Building a Managed Postgres Service in Rust: Part 1
- Beware of the DashMap deadlock
- Embedded Rust Bluetooth on ESP: BLE Client
- Building Stock Market Engine from scratch in Rust (I)
- Rust Unit and Integration Testing in RustRover
- [podcast] cargo-semver-checks with Predrag Gruevski — Rustacean Station
- [video] Data Types - Part 3 of Idiomatic Rust in Simple Steps
- [video] Deconstructing WebAssembly Components by Ryan Levick @ Wasm I/O 2024
- [video] Extreme Clippy for new Rust crates
- [video] [playlist] Bevy GameDev Meetup #2 - March 2024
Crate of the Week
This week's crate is cargo-unfmt, a formatter that formats your code into block-justified text, which sacrifices some readability for esthetics.
Thanks to Felix Prasanna for the self-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.
- greptimedb - Support specifying time ranges in the
COPY FROM
statement to avoid importing unwanted data - greptimedb - Support converting UNIX epoch numbers to specified timezone in
to_timezone
function - mirrord - Capability to modify the local listen address
- mirrord - Fix all check-rust-docs warnings
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Braintree
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Fiserv
- Hyperswitch - [REFACTOR]: Remove Default Case Handling - Globepay
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.
- RustConf 2024 | Closes 2024-04-25 | Montreal, Canada | Event date: 2024-09-10
- RustLab 2024 | Closes 2024-05-01 | Florence, Italy | Event date: 2024-11-09 - 2024-11-11
- EuroRust 2024| Closes 2024-06-03 | Vienna, Austria & online | Event date: 2024-10-10
- Scientific Computing in Rust 2024| Closes 2024-06-14 | online | Event date: 2024-07-17 - 2024-07-19
- Conf42 Rustlang 2024 | Closes 2024-07-22 | online | Event date: 2024-08-22
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
431 pull requests were merged in the last week
- CFI: (actually) check that methods are object-safe before projecting their receivers to
dyn Trait
in CFI - CFI: abstract Closures and Coroutines
- CFI: fix drop and
drop_in_place
- CFI: fix methods as function pointer cast
- CFI: support calling methods on supertraits
- add a
CurrentGcx
type to let the deadlock handler accessTyCtxt
- add basic trait impls for
f16
andf128
- add detection of (
Partial
)Ord
methods in theambiguous_wide_pointer_comparisons
lint - add rust-lldb pretty printing for Path and PathBuf
- assert that ADTs have the right number of args
- codegen const panic messages as function calls
- coverage: re-enable
UnreachablePropagation
for coverage builds - delegation: fix ICE on wrong
Self
instantiation - delegation: fix ICE on wrong
self
resolution - do not attempt to write
ty::Err
on binding that isn't from current HIR Owner - don't check match scrutinee of postfix match for unused parens
- don't inherit codegen attrs from parent static
- eagerly instantiate closure/coroutine-like bounds with placeholders to deal with binders correctly
- eliminate
UbChecks
for non-standard libraries - ensure std is prepared for cross-targets
- fix diagnostics for async block cloning
- fixup parsing of
rustc_never_type_options
attribute - function ABI is irrelevant for reachability
- improve example on inserting to a sorted vector to avoid shifting equal elements
- in
ConstructCoroutineInClosureShim
, pass receiver by mut ref, not mut pointer - load missing type of impl associated constant from trait definition
- make
TyCtxt::coroutine_layout
take coroutine's kind parameter - match ergonomics 2024: implement mutable by-reference bindings
- match lowering: build the
Place
instead of keeping aPlaceBuilder
around - match lowering: consistently merge simple or-patterns
- match lowering: handle or-patterns one layer at a time
- match lowering: sort
Eq
candidates in the failure case too - pattern analysis: Require
enum
indices to be contiguous - replace regions in const canonical vars' types with
'static
in next-solver canonicalizer - require Debug for
Pointee::Metadata
- require
DerefMut
andDerefPure
onderef!()
patterns when appropriate - rework opaque type region inference
- simplify proc macro bridge state
- simplify trim-paths feature by merging all debuginfo options together
- store segment and module in
UnresolvedImportError
- suggest associated type bounds on problematic associated equality bounds
- suggest correct path in
include_bytes!
- use the
Align
type when parsing alignment attributes - warn against implementing Freeze
- enable cargo miri test doctests
- miri: avoid mutating the global environment
- miri: cotrol stacked borrows consistency check with its own feature flag
- miri: experiment with macOS M1 runners
- miri: extern-so: give the version script a better name; show errors from failing to build the C lib
- miri: speed up Windows CI
- miri: tree Borrows: Make tree root always be initialized
- don't emit load metadata in debug mode
- avoid some unnecessary query invocations
- stop doing expensive work in
opt_suggest_box_span
eagerly - stabilize
ptr.is_aligned,
moveptr.is_aligned_to
to a new feature gate - stabilize
unchecked_{add,sub,mul}
- make
{integer}::from_str_radix
constant - optimize
core::char::CaseMappingIter
- implement
Vec::pop_if
- remove len argument from
RawVec::reserve_for_push
- less generic code for Vec allocations
UnixStream
: overrideread_buf
num::NonZero::get
can be 1 transmute instead of 2- fix error message for
env!
when env var is not valid Unicode - futures: make access inner of
futures::io::{BufReader,BufWriter}
not require inner trait bound - regex-syntax: accept
{,n}
as an equivalent to{0,n}
- cargo add: Preserve comments when updating simple deps
- cargo generate-lockfile: hold lock before querying index
- cargo toml: Warn on unused workspace.dependencies keys on virtual workspaces
- cargo fix: bash completion fallback in
nounset
mode - clippy:
large_stack_frames
: print total size and largest component - clippy:
type_id_on_box
: lint on anyBox<dyn _>
- clippy: accept
String
inspan_lint*
functions directly to avoid unnecessary clones - clippy: allow
filter_map_identity
when the closure is typed - clippy: allow
manual_unwrap_or_default
in const function - clippy: don't emit
duplicated_attribute
lint on "complex"cfg
s - clippy: elide unit variables linted by
let_unit
and use()
directly instead - clippy: fix
manual_unwrap_or_default
suggestion ignoring side-effects - clippy: fix suggestion for
len_zero
with macros - clippy: make sure checked type implements
Try
trait when lintingquestion_mark
- clippy: move
box_default
to style, do not suggest turbofishes - clippy: move
mixed_attributes_style
to style - clippy: new lint
legacy_numeric_constants
- clippy: restrict
manual_clamp
to const case, bring it out of nursery - rust-analyzer: add
rust-analyzer.cargo.allTargets
to configure passing--all-targets
to cargo invocations - rust-analyzer: implement resolving and lowering of Lifetimes (no inference yet)
- rust-analyzer: fix crate IDs when multiple workspaces are loaded
- rust-analyzer: ADT hover considering only type or const len not lifetimes
- rust-analyzer: check for client support of relative glob patterns before using them
- rust-analyzer: lifetime length are not added in count of params in highlight
- rust-analyzer: revert debug extension priorities
- rust-analyzer: silence mismatches involving unresolved projections
- rust-analyzer: use lldb when debugging with C++ extension on MacOS
- rust-analyzer: pattern analysis: Use contiguous indices for
enum
variants - rust-analyzer: prompt the user to reload the window when enabling test explorer
- rust-analyzer: resolve tests per file instead of per crate in test explorer
Rust Compiler Performance Triage
A pretty quiet week, with most changes (dropped from the report below) being due to continuing bimodality in the performance data. No particularly notable changes landed.
Triage done by @simulacrum. Revision range: 73476d49..3d5528c
1 Regressions, 2 Improvements, 5 Mixed; 0 of them in rollups 61 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
- No RFCs entered Final Comment Period this week.
Tracking Issues & PRs
Rust
- [disposition: merge] Pass list of defineable opaque types into canonical queries
- [disposition: merge] Document overrides of
clone_from()
in core/std - [disposition: merge] Tracking Issue for
Seek::seek
_relative - [disposition: merge] Tracking Issue for generic
NonZero
- [disposition: merge] Tracking Issue for
cstr_count_bytes
- [disposition: merge] privacy: Stabilize lint
unnameable_types
- [disposition: merge] Stabilize Wasm target features that are in phase 4 and 5
Cargo
- [disposition: merge] feat(add): Stabilize MSRV-aware version req selection
New and Updated RFCs
- [new] RFC: Add
freeze
intrinsic and related library functions - [new] RFC: Add a special TryFrom and Into derive macro, specifically for C-Style enums
- [new] re-organise the compiler team
Upcoming Events
Rusty Events between 2024-04-03 - 2024-05-01 🦀
Virtual
- 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-15 & 2024-04-16 | Virtual | Mainmatter
- 2024-04-16 | Virtual (Dublin, IE) | Rust Dublin
- 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
- 2024-04-25 | Virtual + In Person (Berlin, DE) | OpenTechSchool Berlin + Rust Berlin
- 2024-04-30 | Virtual (Dallas, TX, US) | Dallas Rust
- 2024-05-01 | Virtual (Indianapolis, IN, US) | Indy Rust
Africa
- 2024-04-05 | Kampala, UG | Rust Circle Kampala
Europe
- 2024-04-10 | Cambridge, UK | Cambridge Rust Meetup
- 2024-04-10 | Cologne/Köln, DE | Rust Cologne
- 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
- 2024-04-20 | Augsburg, DE | Augsburger Linux-Infotag 2024
- Augsburger Linux-Infotag 2024: Workshop Einstieg in Embedded Rust mit dem Raspberry Pico WH
- 2024-04-23 | Berlin, DE | Rust Berlin
- 2024-04-25 | Aarhus, DK | Rust Aarhus
- 2024-04-25 | Berlin, DE | Rust Berlin
- 2024-04-27 | Basel, CH | Rust Basel
North America
- 2024-04-04 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-04-04 | Portland, OR, US | PDXRust Meetup
- 2024-04-09 | New York, NY, US | Rust NYC
- 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-15 | Somerville, MA, US | Boston Rust Meetup
- 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
- 2024-04-25 | Nashville, TN, US | Music City Rust Developers
- 2024-04-26 | Boston, MA, US | Boston Rust Meetup
Oceania
- 2024-04-30 | Canberra, ACT, AU | Canberra Rust User 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
Panstromek: I remember reading somewhere (probably here) that borrow checking has
O(n^3)
asymptotic complexity, relative to the size of the function.Nadrieril: Compared to match exhaustiveness which is NP-hard and trait solving which is undecidable, a polynomial complexity feels refreshingly sane.
– Panstromek and Nadrieril on zulip
Thanks to Kevin Reid 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