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
Project/Tooling Updates
Observations/Thoughts
- Rust temporary lifetimes and "super let"
- Behind the Scenes of Rust String Formatting: format_args!()
- Profiling Rust programs the easy way
- Three problems of pinning
- Rust std fs slower than Python!? No, it's hardware!
- Leafpipe - Turning lots and lots of audio/visual into pretty stimuli
- Why Type Safety is Important
Rust Walkthroughs
- “Rustifying” serverless: Boost AWS Lambda performance with Rust - AWS re:Invent talk
- [video] Speeding up Rust code with benchmarks and flamegraphs
- Making a secure Axum route
Miscellaneous
- Diverging Functions - functions that never return
- Getting started with Loco, the one-person web framework for Rust
- Building a Hypercube Interpolator (in Rust)
- Embassy on ESP: GPIO
- [video] Axum 0.6 to 0.7 in 5 quick steps
Crate of the Week
This week's crate is symbols, a utility to quickly create proc-macros to solidify database tables into enums enabling compile time foreign key checks.
Thanks to Marco Napetti for the self-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.
- Ockam - Library - Validate CBOR structs according to the cddl schema for
nodes/models
misc - Ockam - Command - refactor to use typed interfaces to implement commands for
nodes
- Ockam - Library - Slim down the
NodeManagerWorker
fornode / node status
- zerocopy - Test the output of zerocopy-derive
- zerocopy - Use cargo-semver-checks to make sure
derive
feature doesn't change API surface - zerocopy - Verify that
all-jobs-succeeded
CI job depends on all other jobs - Hyperswitch - Refactor - Nuvei - MCA metadata validation
- Hyperswitch - Feature - Noon - Sync with Hyperswitch Reference
- Hyperswitch - Feature - Payme - Sync with Hyperswitch Reference
- Hyperswitch - Bug - MCA metadata deserialization failures should be 4xx
- Hyperswitch - Feature - Zen - Sync with Hyperswitch Reference
If you are a Rust project owner and are looking for contributors, please submit tasks here.
Updates from the Rust Project
369 pull requests were merged in the last week
- add
-Zfunction-return={keep,thunk-extern}
option - account for
!
arm in tailmatch
expr - add
never_patterns
feature gate - add
pretty_terminator
to pretty stable-mir - add an assume that the index is inbounds to
slice::get_unchecked
rustc_span
: Use correct edit distance start length for suggestions- added
linker_arg(s)
Linker trait methods for link-arg to be prefixed "-Wl," for cc-like linker args and not verbatim - allow setting
rla
labels viarustbot
- avoid per-register closure expansions
generic_const_exprs
: suggest to add the feature, not use it- change
SwitchTarget
representation in StableMIR rustc_hir_typeck
: Fix ICE when probing for non-ASCII function alternative- constProp: correctly remove const if unknown value assigned to it
- coverage: skip spans that can't be un-expanded back to the function body
- cut code size for feature hashing
- detect Python-like slicing and suggest how to fix
- detect and reject malformed
repr(Rust)
hints - dispose
llvm::TargetMachines
prior tollvm::Context
being disposed - dont suggest
!
for path in function call if it has generic args - eagerly return
ExprKind::Err
onyield
/await
in wrong coroutine context - effects: run
enforce_context_effects
for all method calls - explain a good reason for why LocalValue does not store the type of the local
- fix ICE:
fn_arg_names: unexpected item DefId(..)
- fix
PartialEq
args when#[const_trait]
is enabled - fix an ICE when a valtree failed to evaluate
- fix parser ICE from attrs
- fix the issue of suggesting unwrap/expect for shorthand field
- give dev-friendly error message for incorrect config profiles
- handle recursion limit for subtype and well-formed predicates
- implement thread parking for xous
- more targeted errors when extern types end up in places they should not
- new solver: improve instrument annotations
- on Fn arg mismatch for a fn path, suggest a closure
- pass +forced-atomics feature for riscv32{i,im,imc}-unknown-none-elf
- perform LTO optimisations with wasm-ld + -Clinker-plugin-lto
- print list of missing target features when calling a function with target features outside an unsafe block
- provide structured suggestion for type mismatch in loop
- remove the memcpy-on-equal-ptrs assumption
- replace
once_cell::sync::OnceCell
with stdOnceLock
- report errors in jobserver inherited through environment variables
- restore
#![no_builtins]
crates participation in LTO - restrict what symbols can be used in
#[diagnostic::on_unimplemented]
format strings - rustc: harmonize
DefKind
andDefPathData
- simplify indenting in THIR printing
- tweak message on ADT with private fields building
- tweak parsing recovery of enums, for exprs and match arm patterns
- warn against using intrinsics that leave the scope of our memory model
- add more information to StableMIR Instance
- codegen, miri: fix computing the offset of an unsized field in a packed
struct
- miri: support 'promising' alignment for symbolic alignment check
- miri: SIMD bitmasks: use 'round up to multiple of 8' rather than 'clamp to at least 8'
- miri: add new SIMD intrinsics
- miri: remove Stacked Borrows GC heuristics
- also add
is_empty
to const raw slices - move exposed-provenance APIs into separate feature gate
- stabilize C string literals
- add substring API for
OsStr
- optimize
str::iter::Chars::advance_by
- add
track_caller
for arith ops - expand in-place iteration specialization to Flatten, FlatMap and ArrayChunks
- cargo resolver: De-prioritize no-rust-version in MSRV resolver
- cargo resolver: Remove unused public-deps error handling
- cargo toml: Decouple logic from schema
- cargo: add
--public
forcargo add
- cargo: add more doc comments for gc changes
- cargo: reorder
--remap-path-prefix
flags for-Zbuild-std
- cargo: fixed uninstall a running binary failed on Windows
- cargo: fixes error count display is different when there's only one error left
- cargo: have cargo add --optional
<dep>
create a<dep>
="dep:<dep>
feature - cargo: include declared list of features in fingerprint for
-Zcheck-cfg
- cargo: remove the outdated comment
- rustdoc: Add highlighting for comments in items declaration
- rustdoc-search: allow spaces around
:
in path query - clippy:
missing_asserts_for_indexing
: accept length equality checks - clippy:
option_if_let_else
: do not trigger on expressions returning()
- clippy:
redundant_closure_call
: avoid duplicatedasync
keyword when triggering on closure that returnsasync
block - clippy:
redundant_guards
: catchis_empty
,starts_with
andends_with
on slices andstr
s - clippy: add lint against unit tests in doctests
- clippy: allow
allow
ingupper_case_acronyms
onenum
variants - clippy: expanding lint
blocks_in_if_conditions
to check match expr as well - clippy: new lint:
repeat_vec_with_capacity
- rust-analyzer: debug use cargo workspace root as
cwd
- rust-analyzer: implement completion for the callable fields
- rust-analyzer: initial support for implicit drop inlay hint
- rust-analyzer: don't make
MissingMatchArms
diagnostic for empty match body - rust-analyzer: improve error handling for top-level
let
statements
Rust Compiler Performance Triage
A small number of perf changes that unfortunately led to quite a few perf regressions. A large chunk of those regressions were in rustdoc and were considered acceptable since rustdoc is now doing strictly more work. Some other regressions have already been fixed and will hopefully soon be merged. The last of the regressions are still under investigation, but hopefully they will be resolved soon.
Triage done by @rylev. Revision range: df0295f0..9358642e
Summary:
(instructions:u) | mean | range | count |
---|---|---|---|
Regressions ❌ (primary) |
3.0% | [0.2%, 12.3%] | 53 |
Regressions ❌ (secondary) |
4.1% | [0.2%, 11.6%] | 102 |
Improvements ✅ (primary) |
-0.3% | [-0.5%, -0.1%] | 65 |
Improvements ✅ (secondary) |
-0.6% | [-1.2%, -0.2%] | 25 |
All ❌✅ (primary) | 1.1% | [-0.5%, 12.3%] | 118 |
4 Regressions, 1 Improvements, 1 Mixed; 1 of them in rollups 60 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
- No RFCs entered Final Comment Period this week.
Tracking Issues & PRs
- [disposition: merge] Add lint against ambiguous wide pointer comparisons
- [disposition: merge] Stabilize
ptr::{from_ref, from_mut
} - [disposition: merge] Tracking issue for
any::type_name_of_val
- [disposition: merge] rustdoc: allow resizing the sidebar / hiding the top bar
- [disposition: merge] Don't merge cfg and doc(cfg) attributes for re-exports
- [disposition: merge] Make
IMPLIED_BOUNDS_ENTAILMENT
into a hard error from a lint - [disposition: merge] Exhaustiveness: reveal opaque types properly
- [disposition: merge] fix fn/const items implied bounds and wf check
- [disposition: merge] guarantee that char and u32 are ABI-compatible
- [disposition: merge] Use version-sorting for all sorting
- [disposition: merge] Tracking Issue for
arc_unwrap_or_clone
- [disposition: merge] adds a column number to
dbg!()
- [disposition: merge] Allow any
const
expression blocks inthread_local!
- [disposition: merge] check
FnDef
return type for WF
Language Reference
- No Language Reference RFCs entered Final Comment Period this week.
Unsafe Code Guidelines
- No Unsafe Code Guideline RFCs entered Final Comment Period this week.
New and Updated RFCs
- RFC: Make Cargo respect minimum supported Rust version (MSRV) when selecting dependencies
- RFC: Trait for !Sized thin pointers
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-12-06 - 2024-01-03 🦀
Virtual
- 2023-12-06 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2023-12-10 | Virtual (Cardiff, UK) | Rust and C++ Cardiff
- 2023-12-12 | Virtual | Mainmatter
- 2023-12-12 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-12-14 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2023-12-14 | Virtual (Nuremberg, DE) | Rust Nuremberg
- 2023-12-17 | Virtual (Tel Aviv, IL) | Code Mavens
- 2023-12-18 | Virtual (Munich, DE) | Rust Munich
- 2023-12-19 | Virtual (Berlin, DE) | OpenTechSchool Berlin
- 2023-12-19 | Virtual (Washington, DC, US) | Rust DC
- 2023-12-20 | Virtual (Vancouver, BC, CA) | Vancouver Rust
- 2023-12-26 | Virtual (Dallas, TX, US) | Dallas Rust
- 2023-12-28 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-01-03 | Virtual (Indianapolis, IN, US) | Indy Rust
Asia
- 2023-12-10 | Tokyo, JP | Tokyo Rust Meetup
- 2023-12-16 | Delhi, IN | Rust Delhi
Europe
- 2023-12-06 | Cologne, DE | Rust Cologne
- 2023-12-07 | Aarhus, DK | Rust Aarhus
- 2023-12-07 | Lille, FR | Rust Lille
- 2023-12-07 | London, UK | Rust London User Group
- 2023-12-14 | Augsburg, DE | Rust - Modern Systems Programming in Leipzig
- 2023-12-14 | Basel, CH | Rust Basel
- 2023-12-18 | Munich, DE + Virtual | Rust Munich
- 2023-12-19 | Heidelberg, DE | Nix Your Bugs & Rust Your Engines
- 2023-12-19 | Leipzig, DE | Rust - Modern Systems Programming in Leipzig
North America
- 2023-12-07 | Seattle, WA, US | Seattle Rust User Group
- 2023-12-11 | Minneapolis, MN, US | Minneapolis Rust Meetup
- 2023-12-12 | Seattle, WA, US | Cap Hill Rust Coding/Hacking/Learning
- 2023-12-12 | New York, NY, US | Rust NYC
- 2023-12-13 | Chicago, IL, US | Deep Dish Rust
- 2023-12-14 | Lehi, UT, US | Utah Rust
- 2023-12-14 | Mountain View, CA, US | Mountain View Rust Meetup
- 2023-12-15 | Somerville, MA, US | Boston Rust Meetup
- 2023-12-19 | San Francisco, CA, US | San Francisco Rust Study Group
- 2023-12-27 | Austin, TX, US | Rust ATX
Oceania
- 2023-12-11 | Perth, WA, AU | Rust Perth Meetup 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
NVIDIA's firmware, Airlie said, comes with a set of include files that, in turn, define structures that change over time. To deal with these changes, the driver is going to need some sort of automated ABI generation; he noted that the developers working on the Apple M1 GPU driver have run into the same problem. This problem could be made easier to tackle, he suggested, if the driver were, like the M1 driver, to be rewritten in Rust.
– Jonathan Corbet paraphrasing David Airlie on Linux Weekly News
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