Skip to content

rust-analyzer subtree update#154241

Merged
rust-bors[bot] merged 123 commits intorust-lang:mainfrom
lnicola:sync-from-ra
Mar 23, 2026
Merged

rust-analyzer subtree update#154241
rust-bors[bot] merged 123 commits intorust-lang:mainfrom
lnicola:sync-from-ra

Conversation

@lnicola
Copy link
Member

@lnicola lnicola commented Mar 23, 2026

Subtree update of rust-analyzer to rust-lang/rust-analyzer@b42b63f.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost

A4-Tacks and others added 30 commits September 3, 2025 07:28
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
}
```
A4-Tacks and others added 18 commits March 21, 2026 16:35
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
@rustbot
Copy link
Collaborator

rustbot commented Mar 23, 2026

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Mar 23, 2026
@lnicola
Copy link
Member Author

lnicola commented Mar 23, 2026

@bors r+ p=1

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

📌 Commit c9a65cf has been approved by lnicola

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2026
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)
@rust-bors rust-bors bot merged commit 08ff97a into rust-lang:main Mar 23, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 23, 2026
@lnicola lnicola deleted the sync-from-ra branch March 23, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.