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
Foundation
Project/Tooling Updates
- Announcing the Tauri v2 Beta Release
- Polars — Why we have rewritten the string data type
- rust-analyzer changelog #219
- Ratatui 0.26.0 - a Rust library for cooking up terminal user interfaces
Observations/Thoughts
- Will it block?
- Embedded Rust in Production ..?
- Let futures be futures
- Compiling Rust is testing
- Rust web frameworks have subpar error reporting
- [video] Proving Performance - FOSDEM 2024 - Rust Dev Room
- [video] Stefan Baumgartner - Trials, Traits, and Tribulations
- [video] Rainer Stropek - Memory Management in Rust
- [video] Shachar Langbeheim - Async & FFI - not exactly a love story
- [video] Massimiliano Mantione - Object Oriented Programming, and Rust
- [audio] Unlocking Rust's power through mentorship and knowledge spreading, with Tim McNamara
- [audio] Asciinema with Marcin Kulik
- Non-Affine Types, ManuallyDrop and Invariant Lifetimes in Rust - Part One
- Nine Rules for Accessing Cloud Files from Your Rust Code: Practical lessons from upgrading Bed-Reader, a bioinformatics library
Rust Walkthroughs
- AsyncWrite and a Tale of Four Implementations
- Garbage Collection Without Unsafe Code
- Fragment specifiers in Rust Macros
- Writing a REST API in Rust
- [video] Traits and operators
- Write a simple netcat client and server in Rust
Miscellaneous
- RustFest 2024 Announcement
- Preprocessing trillions of tokens with Rust (case study)
- All EuroRust 2023 talks ordered by the view count
Crate of the Week
This week's crate is embedded-cli-rs, a library that makes it easy to create CLIs on embedded devices.
Thanks to Sviatoslav Kokurin 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.
- Fluvio - Build a new python wrapping for the fluvio client crate
- Fluvio - MQTT Connector: Prefix auto generated Client ID to prevent connection drops
- Ockam - Implement events in
SqlxDatabase
- Ockam - Output for both
ockam project ticket
andockam project enroll
is improved, with support for--output json
- Ockam - Output for ockam project ticket is improved and information is not opaque
- 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.
- RustNL 2024 CFP closes 2024-02-19 | Delft, The Netherlands | Event date: 2024-05-07 & 2024-05-08
- NDC Techtown CFP closes 2024-04-14 | Kongsberg, Norway | Event date: 2024-09-09 to 2024-09-12
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
309 pull requests were merged in the last week
- add avx512fp16 to x86 target features
- riscv only supports
split_debuginfo=off
for now - target: default to the medium code model on LoongArch targets
#![feature(inline_const_pat)]
is no longer incomplete- actually abort in -Zpanic-abort-tests
- add missing
potential_query_instability
for keys and values in hashmap - avoid ICE when
is_val_statically_known
is not of a supported type - be more careful about interpreting a label/lifetime as a mistyped char literal
- check
RUST_BOOTSTRAP_CONFIG
inprofile_user_dist
test - correctly check
never_type
feature gating - coverage: improve handling of function/closure spans
- coverage: use normal
edition
: headers in coverage tests - deduplicate more sized errors on call exprs
pattern_analysis
: Gracefully abort on type incompatibilitypattern_analysis
: cleanup manual implspattern_analysis
: cleanup the contexts- fix BufReader unsoundness by adding a check in
default_read_buf
- fix ICE on field access on a tainted type after const-eval failure
- hir: refactor getters for owner nodes
- hir: remove the generic type parameter from
MaybeOwned
- improve the diagnostics for unused generic parameters
- introduce support for
async
bound modifier onFn*
traits - make matching on NaN a hard error, and remove the rest of
illegal_floating_point_literal_pattern
- make the coroutine def id of an async closure the child of the closure def id
- miscellaneous diagnostics cleanups
- move UI issue tests to subdirectories
- move predicate, region, and const stuff into their own modules in middle
- never patterns: It is correct to lower
!
to_
- normalize region obligation in lexical region resolution with next-gen solver
- only suggest removal of
as_*
andto_
conversion methods on E0308 - provide more context on derived obligation error primary label
- suggest changing type to const parameters if we encounter a type in the trait bound position
- suppress unhelpful diagnostics for unresolved top level attributes
- miri: normalize
struct
tail in ABI compat check - miri: moving out
sched_getaffinity
interception from linux'shim, FreeBSD su… - miri: switch over to rustc's
tracing
crate instead of using our ownlog
crate - revert unsound libcore changes
- fix some
Arc
allocator leaks - use
<T, U>
for array/slice equalityimpl
s - improve
io::Read::read_buf_exact
error case - reject infinitely-sized reads from
io::Repeat
thread_local::register_dtor
fix proposal for FreeBSD- add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc
- codegen_gcc: improve iterator for files suppression
- cargo: Don't panic on empty spans
- cargo: Improve map/sequence error message
- cargo: apply
-Zpanic-abort-tests
to doctests too - cargo: don't print rustdoc command lines on failure by default
- cargo: stabilize lockfile v4
- cargo: fix markdown line break in cargo-add
- cargo: use spec id instead of name to match package
- rustdoc: fix footnote handling
- rustdoc: correctly handle attribute merge if this is a glob reexport
- rustdoc: prevent JS injection from localStorage
- rustdoc: trait.impl, type.impl: sort impls to make it not depend on serialization order
- clippy:
redundant_locals
: take by-value closure captures into account - clippy: new lint:
manual_c_str_literals
- clippy: add
lint_groups_priority
lint - clippy: add new lint:
ref_as_ptr
- clippy: add configuration for
wildcard_imports
to ignore certain imports - clippy: avoid deleting labeled blocks
- clippy: fixed FP in
unused_io_amount
for Ok(lit), unrachable! and unwrap de… - rust-analyzer: "Normalize import" assist and utilities for normalizing use trees
- rust-analyzer: enable excluding refs search results in test
- rust-analyzer: support for GOTO def from inside files included with
include!
macro - rust-analyzer: emit parser error for missing argument list
- rust-analyzer: swap
Subtree::token_trees
fromVec
to boxed slice
Rust Compiler Performance Triage
Rust's CI was down most of the week, leading to a much smaller collection of commits than usual. Results are mostly neutral for the week.
Triage done by @simulacrum. Revision range: 5c9c3c78..0984bec
0 Regressions, 2 Improvements, 1 Mixed; 1 of them in rollups 17 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] Consider principal trait ref's auto-trait super-traits in dyn upcasting
- [disposition: merge] remove
sub_relations
from theInferCtxt
- [disposition: merge] Optimize away poison guards when std is built with panic=abort
- [disposition: merge] Check normalized call signature for WF in mir typeck
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
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 2024-02-07 - 2024-03-06 🦀
Virtual
- 2024-02-07 | Virtual (Indianapolis, IN, US) | Indy Rust
- 2024-02-08 | Virtual (Charlottesville, NC, US) | Charlottesville Rust Meetup
- 2024-02-08 | Virtual (Nürnberg, DE) | Rust Nüremberg
- 2024-02-10 | Virtual (Krakow, PL) | Stacja IT Kraków
- 2024-02-10 | Virtual (Wrocław, PL) | Stacja IT Wrocław
- 2024-02-13 | Virtual (Dallas, TX, US) | Dallas Rust
- 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 | 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
Asia
- 2024-02-10 | Hyderabad, IN | Rust Language Hyderabad
Europe
- 2024-02-07 | Cologne, DE | Rust Cologne
- 2024-02-07 | London, UK | Rust London User Group
- 2024-02-08 | Bern, CH | Rust Bern
- 2024-02-08 | Oslo, NO | Rust Oslo
- 2024-02-13 | Trondheim, NO | Rust Trondheim
- 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
North America
- 2024-02-07 | Brookline, MA, US | Boston Rust Meetup
- 2024-02-08 | Lehi, UT, US | Utah Rust
- 2024-02-12 | Minneapolis, MN, US | Minneapolis Rust Meetup
- 2024-02-13 | New York, NY, US | Rust NYC
- 2024-02-13 | Seattle, WA, US | Cap Hill Rust Coding/Hacking/Learning
- 2024-02-15 | Boston, MA, US | Boston Rust Meetup
- 2024-02-15 | Seattle, WA, US | Seattle Rust User Group
- 2024-02-20 | San Francisco, CA, US | San Francisco Rust Study Group
- 2024-02-22 | Mountain View, CA, US | Mountain View Rust Meetup
- 2024-02-28 | Austin, TX, US | Rust ATX
Oceania
- 2024-02-19 | Melbourne, VIC, AU + Virtual | Rust Melbourne
- 2024-02-27 | Canberra, ACT, AU | Canberra Rust User Group
- 2024-02-27 | Sydney, NSW, AU | Rust Sydney
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
My take on this is that you cannot use async Rust correctly and fluently without understanding Arc, Mutex, the mutability of variables/references, and how async and await syntax compiles in the end. Rust forces you to understand how and why things are the way they are. It gives you minimal abstraction to do things that could’ve been tedious to do yourself.
I got a chance to work on two projects that drastically forced me to understand how async/await works. The first one is to transform a library that is completely sync and only requires a sync trait to talk to the outside service. This all sounds fine, right? Well, this becomes a problem when we try to port it into browsers. The browser is single-threaded and cannot block the JavaScript runtime at all! It is arguably the most weird environment for Rust users. It is simply impossible to rewrite the whole library, as it has already been shipped to production on other platforms.
What we did instead was rewrite the network part using async syntax, but using our own generator. The idea is simple: the generator produces a future when called, and the produced future can be awaited. But! The produced future contains an arc pointer to the generator. That means we can feed the generator the value we are waiting for, then the caller who holds the reference to the generator can feed the result back to the function and resume it. For the browser, we use the native browser API to derive the network communications; for other platforms, we just use regular blocking network calls. The external interface remains unchanged for other platforms.
Honestly, I don’t think any other language out there could possibly do this. Maybe C or C++, but which will never have the same development speed and developer experience.
I believe people have already mentioned it, but the current asynchronous model of Rust is the most reasonable choice. It does create pain for developers, but on the other hand, there is no better asynchronous model for Embedded or WebAssembly.
– /u/Top_Outlandishness78 on /r/rust
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