From 36e8c9befe375daea193be93ec4d7d8ab9d238f6 Mon Sep 17 00:00:00 2001 From: Andre Bogus Date: Tue, 6 Feb 2024 22:29:21 +0100 Subject: [PATCH] C/QotW and notable changes --- draft/2024-02-07-this-week-in-rust.md | 91 ++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/draft/2024-02-07-this-week-in-rust.md b/draft/2024-02-07-this-week-in-rust.md index a1514d48c..e01f062c3 100644 --- a/draft/2024-02-07-this-week-in-rust.md +++ b/draft/2024-02-07-this-week-in-rust.md @@ -45,7 +45,9 @@ and just ask the editors to select the category. ## Crate of the Week - +This week's crate is [embedded-cli-rs](https://github.com/funbiscuit/embedded-cli-rs), a library that makes it easy to create CLIs on embedded devices. + +Thanks to [Sviatoslav Kokurin](https://users.rust-lang.org/t/crate-of-the-week/2704/1286) for the self-suggestion! [Please submit your suggestions and votes for next week][submit_crate]! @@ -78,7 +80,77 @@ If you are an event organizer hoping to expand the reach of your event, please s ## Updates from the Rust Project - +309 pull requests were [merged in the last week][merged] + +[merged]: https://github.com/search?q=is%3Apr+org%3Arust-lang+is%3Amerged+merged%3A2024-01-30..2024-02-06 + +* [add avx512fp16 to x86 target features](https://github.com/rust-lang/rust/pull/119543) +* [riscv only supports `split_debuginfo=off` for now](https://github.com/rust-lang/rust/pull/120518) +* [target: default to the medium code model on LoongArch targets](https://github.com/rust-lang/rust/pull/120661) +* [`#![feature(inline_const_pat)]` is no longer incomplete](https://github.com/rust-lang/rust/pull/120547) +* [actually abort in -Zpanic-abort-tests](https://github.com/rust-lang/rust/pull/120326) +* [add missing `potential_query_instability` for keys and values in hashmap](https://github.com/rust-lang/rust/pull/120485) +* [avoid ICE when `is_val_statically_known` is not of a supported type](https://github.com/rust-lang/rust/pull/120484) +* [be more careful about interpreting a label/lifetime as a mistyped char literal](https://github.com/rust-lang/rust/pull/120460) +* [check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test](https://github.com/rust-lang/rust/pull/120207) +* [correctly check `never_type` feature gating](https://github.com/rust-lang/rust/pull/120552) +* [coverage: improve handling of function/closure spans](https://github.com/rust-lang/rust/pull/120569) +* [coverage: use normal `edition`: headers in coverage tests](https://github.com/rust-lang/rust/pull/120566) +* [deduplicate more sized errors on call exprs](https://github.com/rust-lang/rust/pull/120293) +* [`pattern_analysis`: Gracefully abort on type incompatibility](https://github.com/rust-lang/rust/pull/120313) +* [`pattern_analysis`: cleanup manual impls](https://github.com/rust-lang/rust/pull/120516) +* [`pattern_analysis`: cleanup the contexts](https://github.com/rust-lang/rust/pull/120321) +* [fix BufReader unsoundness by adding a check in `default_read_buf`](https://github.com/rust-lang/rust/pull/120607) +* [fix ICE on field access on a tainted type after const-eval failure](https://github.com/rust-lang/rust/pull/120616) +* [hir: refactor getters for owner nodes](https://github.com/rust-lang/rust/pull/120346) +* [hir: remove the generic type parameter from `MaybeOwned`](https://github.com/rust-lang/rust/pull/120610) +* [improve the diagnostics for unused generic parameters](https://github.com/rust-lang/rust/pull/120556) +* [introduce support for `async` bound modifier on `Fn*` traits](https://github.com/rust-lang/rust/pull/120392) +* [make matching on NaN a hard error, and remove the rest of `illegal_floating_point_literal_pattern`](https://github.com/rust-lang/rust/pull/116284) +* [make the coroutine def id of an async closure the child of the closure def id](https://github.com/rust-lang/rust/pull/120402) +* [miscellaneous diagnostics cleanups](https://github.com/rust-lang/rust/pull/120571) +* [move UI issue tests to subdirectories](https://github.com/rust-lang/rust/pull/120439) +* [move predicate, region, and const stuff into their own modules in middle](https://github.com/rust-lang/rust/pull/120497) +* [never patterns: It is correct to lower `!` to `_`](https://github.com/rust-lang/rust/pull/120517) +* [normalize region obligation in lexical region resolution with next-gen solver](https://github.com/rust-lang/rust/pull/119101) +* [only suggest removal of `as_*` and `to_` conversion methods on E0308](https://github.com/rust-lang/rust/pull/120473) +* [provide more context on derived obligation error primary label](https://github.com/rust-lang/rust/pull/120469) +* [suggest changing type to const parameters if we encounter a type in the trait bound position](https://github.com/rust-lang/rust/pull/120570) +* [suppress unhelpful diagnostics for unresolved top level attributes](https://github.com/rust-lang/rust/pull/118533) +* [miri: normalize `struct` tail in ABI compat check](https://github.com/rust-lang/rust/pull/120587) +* [miri: moving out `sched_getaffinity` interception from linux'shim, FreeBSD su…](https://github.com/rust-lang/miri/pull/3283) +* [miri: switch over to rustc's `tracing` crate instead of using our own `log` crate](https://github.com/rust-lang/miri/pull/2956) +* [revert unsound libcore changes](https://github.com/rust-lang/rust/pull/120562) +* [fix some `Arc` allocator leaks](https://github.com/rust-lang/rust/pull/120445) +* [use `` for array/slice equality `impl`s](https://github.com/rust-lang/rust/pull/120384) +* [improve `io::Read::read_buf_exact` error case](https://github.com/rust-lang/rust/pull/120523) +* [reject infinitely-sized reads from `io::Repeat`](https://github.com/rust-lang/rust/pull/119991) +* [`thread_local::register_dtor` fix proposal for FreeBSD](https://github.com/rust-lang/rust/pull/120430) +* [add LocalWaker and ContextBuilder types to core, and LocalWake trait to alloc](https://github.com/rust-lang/rust/pull/118960) +* [codegen\_gcc: improve iterator for files suppression](https://github.com/rust-lang/rustc_codegen_gcc/pull/416) +* [cargo: Don't panic on empty spans](https://github.com/rust-lang/cargo/pull/13375) +* [cargo: Improve map/sequence error message](https://github.com/rust-lang/cargo/pull/13376) +* [cargo: apply `-Zpanic-abort-tests` to doctests too](https://github.com/rust-lang/cargo/pull/13388) +* [cargo: don't print rustdoc command lines on failure by default](https://github.com/rust-lang/cargo/pull/13387) +* [cargo: stabilize lockfile v4](https://github.com/rust-lang/cargo/pull/12852) +* [cargo: fix markdown line break in cargo-add](https://github.com/rust-lang/cargo/pull/13400) +* [cargo: use spec id instead of name to match package](https://github.com/rust-lang/cargo/pull/13335) +* [rustdoc: fix footnote handling](https://github.com/rust-lang/rust/pull/120443) +* [rustdoc: correctly handle attribute merge if this is a glob reexport](https://github.com/rust-lang/rust/pull/120501) +* [rustdoc: prevent JS injection from localStorage](https://github.com/rust-lang/rust/pull/120250) +* [rustdoc: trait.impl, type.impl: sort impls to make it not depend on serialization order](https://github.com/rust-lang/rust/pull/120641) +* [clippy: `redundant_locals`: take by-value closure captures into account](https://github.com/rust-lang/rust-clippy/pull/12227) +* [clippy: new lint: `manual_c_str_literals`](https://github.com/rust-lang/rust-clippy/pull/11919) +* [clippy: add `lint_groups_priority` lint](https://github.com/rust-lang/rust-clippy/pull/11832) +* [clippy: add new lint: `ref_as_ptr`](https://github.com/rust-lang/rust-clippy/pull/12087) +* [clippy: add configuration for `wildcard_imports` to ignore certain imports](https://github.com/rust-lang/rust-clippy/pull/11979) +* [clippy: avoid deleting labeled blocks](https://github.com/rust-lang/rust-clippy/pull/12219) +* [clippy: fixed FP in `unused_io_amount` for Ok(lit), unrachable! and unwrap de…](https://github.com/rust-lang/rust-clippy/pull/12217) +* [rust-analyzer: "Normalize import" assist and utilities for normalizing use trees](https://github.com/rust-lang/rust-analyzer/pull/16417) +* [rust-analyzer: enable excluding refs search results in test](https://github.com/rust-lang/rust-analyzer/pull/16441) +* [rust-analyzer: support for GOTO def from *inside* files included with `include!` macro](https://github.com/rust-lang/rust-analyzer/pull/16439) +* [rust-analyzer: emit parser error for missing argument list](https://github.com/rust-lang/rust-analyzer/pull/16493) +* [rust-analyzer: swap `Subtree::token_trees` from `Vec` to boxed slice](https://github.com/rust-lang/rust-analyzer/pull/16482) ### Rust Compiler Performance Triage @@ -266,7 +338,20 @@ Please see the latest [Who's Hiring thread on r/rust](INSERT_LINK_HERE) # 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](https://reddit.com/r/rust/comments/1ai1a97/let_futures_be_futures/korxtar/) + +Thanks to [Brian Kung](https://users.rust-lang.org/t/twir-quote-of-the-week/328/1521) for the suggestion! [Please submit quotes and vote for next week!](https://users.rust-lang.org/t/twir-quote-of-the-week/328)