rust-analyzer subtree update#154241
Merged
rust-bors[bot] merged 123 commits intorust-lang:mainfrom Mar 23, 2026
Merged
Conversation
Example
---
```rust
fn foo() {
{
let closure = |$0| match () {
() => {},
};
closure();
}
}
```
**Before this PR**:
```rust
fn foo() {
{
fn closure() {
match () {
() => {},
}
}
closure();
}
}
```
**After this PR**:
```rust
fn foo() {
{
fn closure() {
match () {
() => {},
}
}
closure();
}
}
```
Example
---
```rust
fn main() {
if $0let (foo, bar) = ("Foo", "Bar") {
code();
}
}
```
->
```rust
fn main() {
if let foo = "Foo"
&& let bar = "Bar" {
code();
}
}
```
Example
---
```rust
fn main() {
Foo { bar$0: false };
}
struct Foo {}
```
->
```rust
fn main() {
Foo { bar: false };
}
struct Foo {
bar: bool,
}
```
Example
---
```rust
pub struct Test {
$0#[foo]
#[bar]$0
test: u32,
}
```
->
```rust
pub struct Test {
#[cfg_attr($0, foo, bar)]
test: u32,
}
```
Changes:
- Add nested lifetime support
- Add explicit infer lifetime support
- Change assist type to `quickfix`
Example
---
```rust
struct Foo {
a: &$0i32,
b: &'_ i32,
c: (&i32, Bar<'_>),
}
```
**Before this PR**:
```rust
struct Foo<'a> {
a: &'a i32,
b: &'_ i32,
c: (&i32, Bar<'_>),
}
```
**After this PR**:
```rust
struct Foo<'a> {
a: &'a i32,
b: &'a i32,
c: (&'a i32, Bar<'a>),
}
```
Example
---
```rust
fn foo() {
let None$0 = Some(5);
}
```
->
```rust
fn foo() {
let None = Some(5) else { return };
}
```
Example
---
```rust
fn main() {
for$0 _ in 0..5 {
break;
continue;
}
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn main() {
'l: for _ in 0..5 {
break 'l;
continue 'l;
}
}
```
Editor adds the current indentation to the content of the code snippet
This PR dedentation is used to offset the editor snippet indentation
Example
---
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
x
.and(y)
.map(|it| it+2)
.$0
};
}
```
**Before this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
**After this PR**
```rust
fn foo(x: Option<i32>, y: Option<i32>) {
let _f = || {
let $0 = x
.and(y)
.map(|it| it+2);
};
}
```
Example
---
```rust
struct Foo(Option<i32>);
fn foo(x: Foo) -> Foo {
match x { Foo($0) => () }
}
```
**Before this PR**
```rust
ty: Foo, name: ?
```
**After this PR**
```rust
ty: Option<i32>, name: ?
```
fix replacing target on lib target kind
These are not used outside of the project-model crate, ie. instantly converted to other structures.
Makes clear to future editors of this code that they should add #[serde(default)] to new fields.
I'm about to complete the match statement here with more of the same. Once you write the exact same code 5 times, it's time for a helper function.
Was deleted when this code was moved in PR 18043.
Allows project JSON users to run a whole module of tests, benchmarks, doctests.
Example
---
**Input**:
```rust
use std::fmt::Error;
$0use std::fmt::Display;
use std::fmt::Debug;
use std::fmt::Write;
use$0 std::fmt::Result;
```
**Before this PR**:
```rust
use std::fmt::Error;
use std::fmt::{Debug, Display, Write};
use std::fmt::Result;
```
**After this PR**:
```rust
use std::fmt::Error;
use std::fmt::{Debug, Display, Result, Write};
```
Example
---
```rust
fn main() {
let Some(2) = None else {$0
return;
};
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn main() {
return;
}
```
Example
---
```rust
fn main() {
let bar = 2;
let f = || bar.$0;
}
```
**Before this PR**
Cannot complete `.let`
**After this PR**
```rust
fn main() {
let bar = 2;
let f = || {
let $1 = bar;
$0
};
}
```
- Do not show commas on label
Example
---
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), mut ba$0)
```
**Before this PR**
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), bar: u32)
```
**After this PR**
```rust
fn f(foo: (), bar: u32) {}
fn g(foo: (), mut bar: u32)
```
Example
---
```rust
fn f() {
if true
&& let xyz = 0
{
xyz$0;
}
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn f() {
if true
{
0;
}
}
```
seven IrPrint::print_debug implementations in the next-solver were placeholder stubs that returned "TODO: <typename>" instead of meaningful output. these are called via the Display impl (and Debug for PatternKind) of these types, so any solver trace log containing them was unreadable. implemented proper formatting for each: - TraitPredicate -> "T: Trait" / "!T: Trait" - HostEffectPredicate -> "const T: Trait" / "[const] T: Trait" - NormalizesTo -> "AliasTerm(...) -> Term" - SubtypePredicate -> "A <: B" - CoercePredicate -> "A -> B" - FnSig -> "fn([inputs]) -> output" - PatternKind -> "start..=end" / "or([...])" / "!null" also removed the now-unused type_name_of_val import.
- Fix parentheses for replace_is_method_with_if_let_method
Example
---
```rust
fn main() {
let x = Some(1);
if x.is_som$0e_and(predicate) {}
}
```
**Before this PR**
```rust
fn main() {
let x = Some(1);
if let Some(x1) = x {}
}
```
**After this PR**
```rust
fn main() {
let x = Some(1);
if let Some(x1) = x && predicate(x1) {}
}
```
…esent
load_workspace_at() looks at parent directories. If rust-analyzer is
in a directory (e.g. a monorepo) where a parent directory contains a
rust-project.json, that configuration wins over the Cargo.toml and the
test fails.
One easy way of testing this is deliberately writing an invalid JSON
file to the parent directory.
```
$ echo '{' > ../rust-project.json
$ cargo t -p load-cargo
---- tests::test_loading_rust_analyzer stdout ----
thread 'tests::test_loading_rust_analyzer' (38576150) panicked at crates/load-cargo/src/lib.rs:756:81:
called `Result::unwrap()` on an `Err` value: Failed to load the project at /Users/wilfred/src/rust-project.json
Caused by:
0: Failed to deserialize json file /Users/wilfred/src/rust-project.json
1: EOF while parsing an object at line 2 column 0
```
Instead, explicitly load the cargo workspace so the presence of a
rust-project.json never changes the result of the test.
AI disclosure: Written with help from Claude.
Example
---
```rust
struct Foo;
fn foo() -> Foo {
$0Foo$0
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
struct Foo;
fn foo() -> Foo {
let foo = Foo;
foo
}
```
Example
---
```rust
fn foo() {
let x;
x =$0 n + 100;
}
```
**Before this PR**
Assist not applicable
**After this PR**
```rust
fn foo() {
let x;
x = {
n + 100
};
}
```
feat: offer 'add_braces' on bin-expr assignment
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.3.3 to 3.4.2. - [Commits](WebReflection/flatted@v3.3.3...v3.4.2) --- updated-dependencies: - dependency-name: flatted dependency-version: 3.4.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com>
…-uses-self fix: Fix overlap edit on record to tuple assist uses self
…rgan internal: Remove clone_for_update from apply_demorgan
Add nested lifetime support for add_lifetime_to_type
…ixes Add fixes for non_exhaustive_let diagnostic
Support WhileExpr and ForExpr for add_label_to_loop
Fix postfix completion indentation compensation
feat: change test_name placeholder to executable_arg
…tibility Project json compatibility improvements
…ble-kinds Support more runnable kinds in project JSON
Add applicable on let-else branch for unwrap_block
…ath-expr fix: offer on const like path-expr for 'extract_variable'
…yarn/editors/code/flatted-3.4.2 Bump flatted from 3.3.3 to 3.4.2 in /editors/code
…oject internal: Fix test_loading_rust_analyzer when rust-project.json is present
Collaborator
|
rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer |
Member
Author
|
@bors r+ p=1 |
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 23, 2026
…uwer Rollup of 13 pull requests Successful merges: - #154241 (`rust-analyzer` subtree update) - #153686 (`std`: include `dlmalloc` for all non-wasi Wasm targets) - #154105 (bootstrap: Pass `--features=rustc` to rustc_transmute) - #153069 ([BPF] add target feature allows-misaligned-mem-access) - #154085 (Parenthesize or-patterns in prefix pattern positions in pretty printer) - #154191 (refactor RangeFromIter overflow-checks impl) - #154207 (Refactor query loading) - #153540 (drop derive helpers during attribute parsing) - #154140 (Document consteval behavior of ub_checks, overflow_checks, is_val_statically_known.) - #154161 (On E0277 tweak help when single type impls traits) - #154218 (interpret/validity: remove unreachable error kind) - #154225 (diagnostics: avoid ICE in confusable_method_name for associated functions) - #154228 (Improve inline assembly error messages)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subtree update of
rust-analyzerto rust-lang/rust-analyzer@b42b63f.Created using https://github.com/rust-lang/josh-sync.
r? @ghost