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
Project/Tooling Updates
- Solving the "floating point precision" problem with... floats?
- Sniffnet v1.2.0
- Bevy + WebGPU
- rust-analyzer changelog #182
- Update-informer v1.0.0
- Pavex, a new Rust web framework - #4: Performance is a feature
- Opensourcing Whichlang, a fast language detection library for Rust
Observations/Thoughts
- How Much Memory Do You Need to Run 1 Million Concurrent Tasks?
- Open sourcing our Rust crate audits
- Rust & Nix: Parallels in Complexity Management
- [audio] PyO3 with David Hewitt
Rust Walkthroughs
- The magic of scope guards
- Mocking in Rust: Mockall and alternatives - LogRocket Blog
- Compress-a-Palooza: Unpacking 5 Billion Varints in only 4 Billion CPU Cycles
- Resilient LL Parsing Tutorial
- ESP32 Embedded Rust at the HAL: Timer Ultrasonic Distance Measurement
- A guide to closures in Rust
- Guide to parsing with nom
- [video] N-Queens Puzzle (PART 2) - Rust - Codurance Screenkata
Research
Miscellaneous
Crate of the Week
This week's crate is whichlang, a fast no-dependencies OSS natural language detector.
Thanks to Brian Kung 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!
Some of these tasks may also have mentors available, visit the task page for more information.
- bilge - Allow others to define their own
-Bits
derives - Hyperswitch - Implement
CardsInfoInterface
forMockDb
- Hyperswitch - Implement
DisputeInterface
forMockDb
- Hyperswitch - Unite payment intent and setup intent in stripe compatibility
If you are a Rust project owner and are looking for contributors, please submit tasks here.
Updates from the Rust Project
314 pull requests were merged in the last week
- CFI: fix
encode_ty
: unexpectedParam(B/#1)
diagnostic
: wrap parens for ref impl trait param- resolve: only disambiguate binding key during define
- add
--remote-time
flag to curl for bootstrap - add a conversion from
&mut T
to&mut UnsafeCell<T>
- add creation time support to
FileTimes
on apple and windows - add derive for
core::marker::ConstParamTy
- always fall back to PartialEq when a constant in a pattern is not recursively structural-eq
- better diagnostic for
use Self::..
- debug format
Const
's less verbosely - do not recover when parsing stmt in cfg-eval
- don't expect normalization to succeed in
elaborate_drops
- don't inline functions with unsized args
- don't skip inference for type in
offset_of!
- don't use inner macro in
marker_impls
- dont check
must_use
on nestedimpl Future
from fn - erase
ReError
properly - erase regions of type in
offset_of!
- exclude inherent projections from some alias type
match
es - fix dependency tracking for debugger visualizers
- fix doc comment for
ConstParamTy
derive - fix duplicate
arcinner_layout_for_value_layout
calls when using the uninitArc
constructors - fix local libs not included when printing native static libs
- fix overflow in error emitter
- fix recursion depth handling after confirmation
- fix: emit error when fragment is
MethodReceiverExpr
and items is empty - get current target config from
--print=cfg
- give a more useful location for where a
span_bug
was delayed - give better error when collecting into
&[T]
- handle error body in generator layout
- improve cgu merging debug output
- keep only the trait when emitting the error for
MyTrait + 'a
- merge return place with other locals in CopyProp
- merge some query impl modules into one
- move
rustc_middle/src/ty/query.rs
torustc_middle/src/query/plumbing.rs
- only depend on
CFG_VERSION
inrustc_interface
- optimize
next_chunk
impls for Filter and FilterMap - process current bucket instead of parent's bucket when starting loop for dominators
- recover
impl<T ?Sized>
correctly - rename
{drop,forget}_{copy,ref}
lints to more consistent naming - replace
QueryStruct
with arrays local torustc_query_impl
- shorten backtraces for queries in ICEs
- shorten even more panic temporary lifetimes
- specialize
ToString
implementation forfmt::Arguments
- specialize query execution for incremental and non-incremental
- support PGO on custom project
- support RISC-V unaligned-scalar-mem target feature
- suppress "erroneous constant used" for constants tainted by errors
- use error term in projection if missing associated item in new solver
- add the weak-intrinsics feature
- stabilize feature
cstr_is_empty
- stabilize feature
nonzero_negation_ops
- constify
slice_as_chunks
(unstable) - use code with reliable branchless code-gen for
slice::sort
merge ascii::Char
-ify the escaping code in core- hashbrown: add NEON backend for RawTable
- hashbrown: add support for allocator-api2
- regex syntax: fix overflow for big counted repetitions
- cargo:
lints
feature - cargo: pass
-C debuginfo
after weakening if explicitly set - rustdoc: hide repr attribute from doc of types without guaranteed repr
- rustdoc: include strikethrough in item summary
- rustdoc: Only keep impl blocks from bodies
- clippy: add
minimal_cfg_condition
lint - clippy:
SpanlessEq
improvements - clippy:
match_wild_err_arm
: do not lint in const contexts - clippy:
redundant_pattern_matching
: check for single-arm match - clippy:
dbg_macro
: don't removedbg!
in arbitrary expressions - clippy: don't suggest unnameable types in
box_default
,let_underscore_untyped
- clippy: enhance
needless_collect
: lint in method/function arguments that take anIntoIterator
- clippy: fix
invalid_regex
not recognizing new syntax introduced after regex-1.8.0 - clippy: fix some suggestions generated by the
option_if_let_else
lint - clippy: ignoring
let_underscore_untyped
warnings in code from proc macros - clippy: rename
integer_arithmetic
- rust-analyzer: consider block impls in
lookup_impl_assoc_item_for_trait_ref
- rust-analyzer: expand
format_args!
with more details - rust-analyzer: add
moved-out-of-ref
diagnostic - rust-analyzer: highlight used trait assoc items when cursor is on trait import or trait bound
- rust-analyzer: render hover actions for closure captures and sig
- rust-analyzer: support C string literals
- rust-analyzer: consider all tokens in macro expr when analyzing locals
- rust-analyzer: fix
preorder_expr
skipping theelse
block of let-else statements - rust-analyzer: fix evaluating negation for floating point types
- rust-analyzer: handle match scrutinee in closure captures
- rust-analyzer: introduce new type var when expectation for ref pat is not ref
- rust-analyzer: place type inlay hints after the item and without left-padding
- rust-analyzer: process
macro_use
prelude in semantic scope resolver
Rust Compiler Performance Triage
There were a few regressions, but most were expected, and one in particular (PR #111807) is expected yield gains in object code performance at the expense of a slight compile-time hit. There are a couple PR's that need future followup, namely PRs #111364 and #111524.
Triage done by @pnkfelix. Revision range: 3ea9ad53..cda5becc
3 Regressions, 2 Improvements, 5 Mixed; 2 of them in rollups 51 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] eRFC: single-file packages ("cargo script") integration
Tracking Issues & PRs
- [disposition: merge] Stabilize inline asm for LoongArch64 (editor's note: "LoongArch" is not a typo)
- [disposition: merge] Uplift
clippy::invalid_utf8_in_unchecked
lint - [disposition: merge] Uplift
clippy::cast_ref_to_mut
lint - [disposition: merge] Uplift
clippy::undropped_manually_drops
lint - [disposition: merge] Make pointer_structural_match normal and warn
- [disposition: merge] [mir-opt] SimplifyLocals should also clean up debuginfo
- [disposition: merge] Remove structural match from
TypeId
- [disposition: merge] Fix docs for
alloc::realloc
New and Updated RFCs
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-05-24 - 2023-06-21 🦀
Virtual
- 2023-05-25 | Virtual (Charlottesville, VA, US) | Charlottesville Rust Meetup
- 2023-05-25 | Virtual (Ciudad de México, MX) | Rust MX
- 2023-05-25 | Virtual (Karlsruhe, DE) | The Karlsruhe Functional Programmers Meetup Group
- 2023-05-25 | Virtual (Raleigh, NC, US) | Triangle BitDevs
- 2023-05-25 | Virtual (San Francisco, CA, US) | Data + AI Online Meetup
- 2023-05-30 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-05-31 | Virtual (Chicago, IL, US) | Chicago Healthcare Cloud Technology Community
- 2023-06-06 | Virtual (Austin, TX, US) | WebAssembly and WasmEdge
- 2023-06-06 | Virtual (Berlin, DE) | OpenTechSchool Berlin
- 2023-06-06 | Virtual (Buffalo, NY, US) | Buffalo Rust Meetup
- 2023-06-07 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2023-06-07 | Virtual (Stuttgart, DE) | Rust Community Stuttgart
- 2023-06-08 | Virtual (Nürnberg, DE) | Rust Nuremberg
- 2023-06-13 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-06-20 | Virtual (Berlin, DE) | Berline.rs / OpenTechSchool Berlin
- 2023-06-20 | Virtual (Washington, DC, US) | Rust DC
- 2023-06-21 | Virtual (Vancouver, BC, CA) | Vancouver Rust
Asia
- 2023-05-25 | Amsterdam, NL | Frontend Developer Meetup Amsterdam
- 2023-06-10 | Kuala Lumpur, MY | GoLang Malaysia
Europe
- 2023-05-24 | Lyon, FR | Rust Lyon
- 2023-05-25 | Barcelona, ES | C++ Programmer Meetup.
- 2023-05-25 | Copenhagen, DK | Copenhagen Rust Community
- 2023-05-25 | Paris, FR | Rust Paris
- 2023-05-30 | Barcelona, ES | BcnRust
- 2023-06-03 | Plovidv, BG | AeroRust
- 2023-06-04 | Plovidv, BG | AeroRust
- 2023-06-08 | Aarhus, DK | Rust Aarhus
- 2023-06-08 | Zurich, CH | Rust Zurich
Oceania
- 2023-05-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
I guess the nicest example of this phenomenon is shared mutability. Programmers have been arguing for decades whether it is sharing xor mutability that causes memory safety bugs:
- "It's threads!" – shouted JavaScript and Python, and JS remained single-threaded, and Python introduced the GIL.
- "It's mutability!" – screamed Haskell and Erlang, and they made (almost) everything immutable.
And then along came Rust, and said: "you are fools! You can have both sharing and mutability in the same language, as long as you isolate them from each other."
Thanks to Jacob Pratt 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