Skip to content

rust-analyzer subtree update#157251

Open
lnicola wants to merge 200 commits into
rust-lang:mainfrom
lnicola:sync-from-ra
Open

rust-analyzer subtree update#157251
lnicola wants to merge 200 commits into
rust-lang:mainfrom
lnicola:sync-from-ra

Conversation

@lnicola
Copy link
Copy Markdown
Member

@lnicola lnicola commented Jun 1, 2026

Subtree update of rust-analyzer to rust-lang/rust-analyzer@123c166.

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

r? @ghost

ChayimFriedman2 and others added 30 commits April 27, 2026 03:56
Example
---
```rust
fn foo() {
    let foo = Ok(1);
    return foo.unwrap_$0or(2);
}
```

**Before this PR**

```rust
fn foo() {
    let foo = Ok(1);
    return foo.unwrap_or_else(|| 2);
}
```

**After this PR**

```rust
fn foo() {
    let foo = Ok(1);
    return foo.unwrap_or_else(|e| 2);
}
```
The most important reason is incrementality. While not a lot of things depend on the stability of `EnumVariantId`, it's still useful to have them stable.

However it turns out that many things actually do want the name, more than those that want the index.
`ThinVec` doesn't allocate when empty.
Previously module ID reuse was based on order of creation solely. Now we store the parent module and name, and so Salsa will reuse the ID for modules that have the same name and parent.

This is important as many interned IDs contain modules, so if the module is invalidated they too are.
Example
---
```rust
struct Foo(&'static str);

impl Foo {
    fn text(&self) -> &str { self.0 }
}

fn main() {
    let s = Foo("");
    $0print!("{}{}", s, s);$0
    let _ = s.text() == "";
}
```

**Before this PR**

```rust
fn $0fun_name(s: &Foo) {
    *print!("{}{}", s, s);
}
```

**After this PR**

```rust
fn $0fun_name(s: &Foo) {
    print!("{}{}", *s, *s);
}
```

---

```rust
macro_rules! refmut { ($e:expr) => { &mut $e }; }
fn foo() {
    let mut n = 1;
    $0let v = refmut!(n);
    *v += 1;$0
    let k = n;
}
```

**Before this PR**

```rust
fn $0fun_name(n: &mut i32) {
    let v = refmut!(n);
    *v += 1;
}
```

**After this PR**

```rust
fn $0fun_name(n: &mut i32) {
    let v = refmut!(*n);
    *v += 1;
}
```
minor: Replace `cfg-if` with `std::cfg_select`
…ge-pat-e0029

feat: add diagnostic for E0029
Encode the name instead of index in `EnumVariantId`
…-exhaustive-record-pat

feat: add diagnostic for E0638
Signed-off-by: Kai Tanaka <275430420+quyentonndbs@users.noreply.github.com>
…ords-in-stdx-and-ide-comments

fix: duplicated words in stdx/assert.rs and ide/inject.rs doc-comments
  `request.rs` was passing `binary_target = true` for
  TargetKind::Bin, Example, and Test, but not for Bench, so a
  `fn main()` in `benches/foo.rs` (typical with
  `harness = false`) was suppressed by `should_skip_runnable`
  in the annotations layer.  Mirror `target_spec.rs:255` by
  including Bench in both the code-lens config check and
  `should_skip_target`.

  Closes rust-lang/rust-analyzer#21948.

Signed-off-by: Onyeka Obi <softwareengineerasaservant@isurvivable.cv>
perf: Provide access to `RootDatabase`'s `LineIndex` for the proc macro protocol
fix: show Run lens for fn main in bench targets
Show `const` in the signature help if applicable
…se_path_seg

Fix assit `qualify_path` loses path segment
fix: handle usages in macro for extract_function
Previously, adding newline between statements was often redundant

Example
---
```rust
fn main() {
    let bar = Some(true);
    bar.$0
    other();
}
```

**Before this PR**

```rust
fn main() {
    let bar = Some(true);
    let Some(${1:bar}) = bar else {
        $2
    };
    $0
    other();
}
```

**After this PR**

```rust
fn main() {
    let bar = Some(true);
    let Some(${1:bar}) = bar else {
        $2
    };$0
    other();
}
```
A4-Tacks and others added 7 commits June 1, 2026 07:17
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 1, 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 Jun 1, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 1, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@lnicola
Copy link
Copy Markdown
Member Author

lnicola commented Jun 1, 2026

@bors r+ p=1

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 1, 2026

📌 Commit 08b5b88 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 Jun 1, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 1, 2026
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to rust-lang/rust-analyzer@123c166.

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

r? @ghost
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.
Link to failure: #157261 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 1, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Jun 1, 2026

This pull request was unapproved.

This PR was contained in a rollup (#157261), which was unapproved.

View changes since this unapproval

@lnicola
Copy link
Copy Markdown
Member Author

lnicola commented Jun 2, 2026

Do you have any tips for reproducing this? ./x.py build src/tools/rust-analyzer works for me.

@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented Jun 2, 2026

Almost certainly caused by my last rust-analyzer PR. It may be necessary to add #![cfg_attr(feature = "in-rust-tree", feature(rustc_private))] to all crates that directly or indirectly depend on proc-macro-api. Both the main crate of a package and all test crates.

@lnicola
Copy link
Copy Markdown
Member Author

lnicola commented Jun 2, 2026

Yup, sounds like that, I just hoped to have a way to test it locally.

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

How about ./x test src/tools/rust-analyzer?

@lnicola
Copy link
Copy Markdown
Member Author

lnicola commented Jun 2, 2026

Build completed successfully in 0:00:06

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Hmmm that's weird, because that is the command the CI is running when it fails afaik

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

JonathanBrouwer commented Jun 2, 2026

I just tried ./x test src/tools/rust-analyzer and it fails locally with the same errors as CI
I'm on x86_64 linux if that's relevant

@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented Jun 2, 2026

Which bootstrap.toml config profile are you both on?

@lnicola
Copy link
Copy Markdown
Member Author

lnicola commented Jun 2, 2026

The tools one, but I managed to reproduce it after setting up the profile and ./x clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.