Skip to content

rust-analyzer subtree update - #162045

Merged
rust-bors[bot] merged 56 commits into
rust-lang:mainfrom
lnicola:sync-from-ra
Sep 1, 2026
Merged

rust-analyzer subtree update#162045
rust-bors[bot] merged 56 commits into
rust-lang:mainfrom
lnicola:sync-from-ra

Conversation

@lnicola

@lnicola lnicola commented Aug 31, 2026

Copy link
Copy Markdown
Member

ChayimFriedman2 and others added 30 commits August 17, 2026 03:05
It turns out they should be treated as bare idents, not patterns, but only if they have no body.

Also allow macro patterns for both them and extern fns, because rustc allows that.
We accidentally skipped one level more than needed.
That also deletes the file when the process exits without being dropped; this is important especially for the proc macro server since it is killed and does not exit normally.

Linux and the BSDs unlink the file then access it via `/proc/self/fd` or `/dev/fd`; Windows has a dedicated API for that; and macOS unfortunately does not support that (the file is not removed after being unlinked, but you cannot access it anymore via `/dev/fd`, or at least that's what the AI said - I don't have a macOS machine to check).
Example
---
```rust
fn foo() {$0
    45
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
fn foo() -> i32 {
    45
}
```
Example
---
```rust
macro_rules! identity { ($($t:tt)*) => {$($t)*}; }
identity! {
    fn foo() u$0
}
```

**Before this PR**

```rust
macro_r-> ules! identity { ($($t:tt)*) => {$($t)*}; }
identity! {
    fn foo() u32
}
```

**After this PR**

```rust
macro_rules! identity { ($($t:tt)*) => {$($t)*}; }
identity! {
    fn foo() -> u32
}
```
minor: offer 'add_return_type' after l_curly
fix: adds-arrow unmap ranges when fn inside macro
minor: Remove non-longer-needed remnants from previous versions of the tt encoding
When writing `foo.0` where `foo` is a union, we'd end up panicking with:

    Failed to make ast node `syntax::ast::generated::nodes::Name` from text mod 0;

This is because `make::name()` requires a legal ident. In
480db310b60fb4ec20deecdd26a066e026c0b522 we added checks for numeric
fields (i.e. `.0` instead of `.foo`) in several code paths but missed
the union case.

Rather than adding another check, just change the fix to never be
offered when the field name isn't a valid identifier.

Add a unit test for the union case too.

AI disclosure: Code partly written by GPT-5.6, review and commit
message by me.
Add backticks so it's easier to see exactly what the input was.
…-panic

fix: Panic on accessing numeric fields in unions
internal: Improve panic messages on invalid AST nodes
Previously, code like `let &(x, y) = unknown_var;` would produce a
panic of the form:

    deref projection of non-dereferenceable ty PlaceTy { ... }

Fix MIR lowering so we only project out of references if the type is a
reference, and treat it as a MIR lowering error otherwise.

AI disclosure: Code partly written by GPT-5.6, commit message and
review entirely done by a human.
…panic

fix: panic on deref of unresolved aliases
… expressions.

This change allows a “mistake” I make very often to succeed: putting
the cursor on “foo” in `Struct { foo: bar() }` when I want to
extract `let foo = bar();`.

It is also groundwork for being able to extract multiple field
expressions at once.
fix: Fix HIR lowering of params of trait assoc fns
fix: Switch from `temp-dir` to a homemade `NamedTempFile` implementation
…-owner

fix: Push a generic params scope for consts
internal: Require rustc citation for analysis changes when using AI
…-never

fix: reinfer never type in array repeat expressions
@rustbot

rustbot commented Aug 31, 2026

Copy link
Copy Markdown
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

@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 Aug 31, 2026
@rust-log-analyzer

This comment has been minimized.

@lnicola

lnicola commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Hmm, I can't reproduce this with ./x.py check.

EDIT: oh, it's Windows only.

@lnicola

lnicola commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@bors r+ p=1

@rust-bors

rust-bors Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 3d677d3 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 Aug 31, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 31, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 31, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #162045 (`rust-analyzer` subtree update)
 - #162077 (compiler-builtins subtree update)
 - #137720 (support `#[target_feature(enable = ...)]` on `#[naked]` functions)
 - #160534 (stabilize smart pointer map functions)
 - #160551 (mir_build: Clearly distinguish or/refutable/irrefutable patterns during match lowering)
 - #161929 (explicitly track inherent const generic args kind)
 - #162063 (Switch dist-aarch64-linux to EC2 and update dist-x86_64-linux)
 - #161937 (A series of Polonius Alpha refactors)
 - #162014 (Move more `rustdoc-html` tests using `--test` into the right folder)
 - #162051 (`rustc_feature` cleanups)
 - #162055 (remove `_{style}` recovery for diagnostic structs)
 - #162075 (Move track_caller on closures gating to attribute parsing)
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 1, 2026
@rust-bors

rust-bors Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: lnicola
Duration: 3h 10m 48s
Pushing 7022271 to main...

@rust-bors
rust-bors Bot merged commit 7022271 into rust-lang:main Sep 1, 2026
14 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 0dfb098 (parent) -> 7022271 (this PR)

Test differences

Show 42 test diffs

Stage 0

  • attrs::docs::tests::block_doc_comment_source_map: [missing] -> pass (J0)
  • attrs::docs::tests::block_doc_comment_stars: [missing] -> pass (J0)
  • attrs::docs::tests::sugared_desugared_mix: [missing] -> pass (J0)
  • handlers::extract_variable::tests::dont_extract_in_pattern_with_selection: [missing] -> pass (J0)
  • handlers::extract_variable::tests::dont_extract_in_pattern_without_selection: [missing] -> pass (J0)
  • handlers::extract_variable::tests::extract_var_from_record_field: [missing] -> pass (J0)
  • handlers::extract_variable::tests::extract_var_from_record_field_colon: [missing] -> pass (J0)
  • handlers::extract_variable::tests::extract_var_from_record_field_name: [missing] -> pass (J0)
  • handlers::extract_variable::tests::extract_var_in_macro_call_with_multiple_args: [missing] -> pass (J0)
  • handlers::extract_variable::tests::extract_var_in_macro_call_with_single_arg: [missing] -> pass (J0)
  • handlers::missing_unsafe::tests::raw_ref_deref_raw_ref_deref: [missing] -> pass (J0)
  • handlers::unresolved_field::tests::no_fix_when_indexed_on_union: [missing] -> pass (J0)
  • hover::tests::extern_c_fn_ptr_display: [missing] -> pass (J0)
  • hover::tests::hover_doc_block_style_leading_asterisks: [missing] -> pass (J0)
  • hover::tests::subst_impl_trait_arg_with_const_generic: [missing] -> pass (J0)
  • mir::lower::tests::ref_pattern_on_unresolved_alias: [missing] -> pass (J0)
  • tests::display_source_code::render_dyn_ty_under_enclosing_binder: [missing] -> pass (J0)
  • tests::expression::const_is_type_owner: [missing] -> pass (J0)
  • tests::never_type::array_repeat_never_can_be_reinferred: [missing] -> pass (J0)
  • tests::regression::trait_assoc_fns_cannot_have_param_patterns: [missing] -> pass (J0)

Stage 1

  • attrs::docs::tests::block_doc_comment_source_map: [missing] -> pass (J1)
  • attrs::docs::tests::block_doc_comment_stars: [missing] -> pass (J1)
  • attrs::docs::tests::sugared_desugared_mix: [missing] -> pass (J1)
  • handlers::extract_variable::tests::dont_extract_in_pattern_with_selection: [missing] -> pass (J1)
  • handlers::extract_variable::tests::dont_extract_in_pattern_without_selection: [missing] -> pass (J1)
  • handlers::extract_variable::tests::extract_var_from_record_field: [missing] -> pass (J1)
  • handlers::extract_variable::tests::extract_var_from_record_field_colon: [missing] -> pass (J1)
  • handlers::extract_variable::tests::extract_var_from_record_field_name: [missing] -> pass (J1)
  • handlers::extract_variable::tests::extract_var_in_macro_call_with_multiple_args: [missing] -> pass (J1)
  • handlers::extract_variable::tests::extract_var_in_macro_call_with_single_arg: [missing] -> pass (J1)
  • handlers::missing_unsafe::tests::raw_ref_deref_raw_ref_deref: [missing] -> pass (J1)
  • handlers::unresolved_field::tests::no_fix_when_indexed_on_union: [missing] -> pass (J1)
  • hover::tests::extern_c_fn_ptr_display: [missing] -> pass (J1)
  • hover::tests::hover_doc_block_style_leading_asterisks: [missing] -> pass (J1)
  • hover::tests::subst_impl_trait_arg_with_const_generic: [missing] -> pass (J1)
  • mir::lower::tests::ref_pattern_on_unresolved_alias: [missing] -> pass (J1)
  • tests::display_source_code::render_dyn_ty_under_enclosing_binder: [missing] -> pass (J1)
  • tests::expression::const_is_type_owner: [missing] -> pass (J1)
  • tests::never_type::array_repeat_never_can_be_reinferred: [missing] -> pass (J1)
  • tests::regression::trait_assoc_fns_cannot_have_param_patterns: [missing] -> pass (J1)

Additionally, 2 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 70222712809cd5cc1718ed8995914a1cbacb6b92 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-loongarch64-musl: 1h 23m -> 2h 17m (+63.8%)
  2. dist-x86_64-freebsd: 58m 40s -> 1h 29m (+52.0%)
  3. x86_64-gnu-gcc-core-tests: 20m 20s -> 11m 16s (-44.6%)
  4. dist-sparcv9-solaris: 1h 12m -> 1h 43m (+42.0%)
  5. x86_64-rust-for-linux: 38m 25s -> 53m 24s (+39.0%)
  6. x86_64-gnu-llvm-21: 37m 4s -> 50m 55s (+37.4%)
  7. x86_64-msvc-ext2: 1h 21m -> 1h 51m (+36.0%)
  8. x86_64-gnu-llvm-22-1: 53m 28s -> 1h 11m (+34.1%)
  9. dist-i686-linux: 1h 55m -> 1h 19m (-31.4%)
  10. i686-gnu-1: 2h 9m -> 1h 29m (-30.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (7022271): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.4% [0.4%, 0.4%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -7.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-7.7% [-7.7%, -7.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -7.7% [-7.7%, -7.7%] 1

Cycles

Results (secondary -2.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-2.9%, -2.9%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 480.061s -> 475.539s (-0.94%)
Artifact size: 400.54 MiB -> 400.59 MiB (0.01%)

@lnicola
lnicola deleted the sync-from-ra branch September 1, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.