Skip to content

Conversation

@matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Nov 3, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Kivooeo and others added 20 commits October 25, 2025 13:27
When a binding needs to be mutably reborrowed multiple times, suggesting removing `&mut` will lead to follow up errors. Instead suggest both making the binding mutable and removing the reborrow.

```
error[E0596]: cannot borrow `outer` as mutable, as it is not declared as mutable
 --> f14.rs:2:12
  |
2 |     match (&mut outer, 23) {
  |            ^^^^^^^^^^ cannot borrow as mutable
  |
note: the binding is already a mutable borrow
 --> f14.rs:1:16
  |
1 | fn test(outer: &mut Option<i32>) {
  |                ^^^^^^^^^^^^^^^^
help: consider making the binding mutable if you need to reborrow multiple times
  |
1 | fn test(mut outer: &mut Option<i32>) {
  |         +++
help: if there is only one mutable reborrow, remove the `&mut`
  |
2 -     match (&mut outer, 23) {
2 +     match (outer, 23) {
  |
```
This commit fixes an accidental regression from 144678 where wasm
targets would now accidentally use the wrong import module map for a
symbol causing a symbol to skip mangling. This can result in compilation
failures when symbols are used in cross-crate situations.

Closes 148347
```
error[E0401]: can't use `Self` from outer item
  --> $DIR/E0401.rs:22:25
   |
LL | impl<T> Iterator for A<T> {
   | ---- `Self` type implicitly declared here, by this `impl`
...
LL |         fn helper(sel: &Self) -> u8 {
   |            ------       ^^^^ use of `Self` from outer item
   |            |
   |            `Self` used in this inner function
   |
help: refer to the type directly here instead
   |
LL -         fn helper(sel: &Self) -> u8 {
LL +         fn helper(sel: &A<T>) -> u8 {
   |
```
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Suggest making binding `mut` on `&mut` reborrow

When a binding needs to be mutably reborrowed multiple times, suggesting removing `&mut` will lead to follow up errors. Instead suggest both making the binding mutable and removing the reborrow.

```
error[E0596]: cannot borrow `outer` as mutable, as it is not declared as mutable
 --> f14.rs:2:12
  |
2 |     match (&mut outer, 23) {
  |            ^^^^^^^^^^ cannot borrow as mutable
  |
note: the binding is already a mutable borrow
 --> f14.rs:1:16
  |
1 | fn test(outer: &mut Option<i32>) {
  |                ^^^^^^^^^^^^^^^^
help: consider making the binding mutable if you need to reborrow multiple times
  |
1 | fn test(mut outer: &mut Option<i32>) {
  |         +++
help: if there is only one mutable reborrow, remove the `&mut`
  |
2 -     match (&mut outer, 23) {
2 +     match (outer, 23) {
  |
```

Address rust-lang#81059.
…zelmann

Port `cfg!()` macro to the new attribute parsing system

r? ``@jdonszelmann``
…avidtwco

Add check for `+=` typo in let chains

Fixes rust-lang#147664

it does affect only cases where variable exist in scope, because if the variable is not exist in scope, the suggestion will not make any sense

I wanted to add suggestion for case where variable does not in scope to fix `y += 1` to `let y = 1` but I guess it's too much (not too much work, but too much wild predict of what user wants)? if it's good addition in your opinion I can add this in follow up

in other things I guess impl is pretty much self-explanatory, if you see there is some possibilities to improve code or/and some _edge-cases_ that I could overlooked feel free to tell about it

ah, also about why I think this change is good and why I originally took it, so it seems to me that this is possible to make this typo (I explained this in comment a little), like, both `+` and `=` is the same button (in most of layouts) and for this reasons I didn't added something like `-=` it seems more harder to make this typo

r? diagnostics
…ributes, r=estebank

fix: Only special case single line item attribute suggestions

`rustc` currently special cases suggestions to add [`#[derive(_)]\n` and other attributes](https://github.com/rust-lang/rust/blob/dc1feabef242259d61bd930713de3250577c1c71/compiler/rustc_errors/src/emitter.rs#L2288C36-L2288C72), to add more context to the suggestions.

> // The suggestion adds an entire line of code, ending on a newline, so we'll also
> // print the *following* line, to provide context of what we're advising people to
> // do. Otherwise you would only see contextless code that can be confused for
> // already existing code, despite the colors and UI elements.
> // We special case `#[derive(_)]\n` and other attribute suggestions, because those
> // are the ones where context is most useful.

This special case is a bit broad at the moment and applies to suggestions just to add an attribute, as well as suggestions that contain an attribute and other code, i.e.
```rust
#[derive(Clone)]
```
and
```rust
#[cfg(not(test))]
impl Default for NewWithCfg {
    fn default() -> Self {
        Self::new()
    }
}
```

In the latter case, adding a line for context after the suggestion doesn't provide much benefit. Example:
![temp](https://github.com/user-attachments/assets/6859b400-aa99-4c1b-9eb0-0cd67ae35bf9)

This PR makes it so that this special case only applies to suggestions that just add an attribute and nothing else. This will also make `rustc`'s output match `annotate-snippets`.
reflect that type and const parameter can be intermixed

Also, add reference id
…=jackh726

Fix `wasm_import_module` attribute cross-crate

This commit fixes an accidental regression from rust-lang#144678 where wasm targets would now accidentally use the wrong import module map for a symbol causing a symbol to skip mangling. This can result in compilation failures when symbols are used in cross-crate situations.

Closes rust-lang#148347
Tweak E0401

More accurate span pointing at use place of outer param (at ident instead of full path).

Add note explaining why outer item params can't be used in inner item.

Use structured suggestion for what `Self` should have been.

Follow up to rust-lang#148370.

Fix rust-lang#37892.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Nov 3, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Nov 3, 2025

📌 Commit bcf227a has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors 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 Nov 3, 2025
@bors
Copy link
Collaborator

bors commented Nov 3, 2025

⌛ Testing commit bcf227a with merge 5f9dd05...

@bors
Copy link
Collaborator

bors commented Nov 4, 2025

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 5f9dd05 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 4, 2025
@bors bors merged commit 5f9dd05 into rust-lang:master Nov 4, 2025
12 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 4, 2025
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#147141 Suggest making binding mut on &mut reborrow 6e4ccf2bb1f1deef34aa9373136effcc48993896 (link)
#147945 Port cfg!() macro to the new attribute parsing system 69923606675f2137e476cdc433e093936fc5c0b9 (link)
#147951 Add check for += typo in let chains e09ec15498a018f5933760eaf905477628b5e211 (link)
#148004 fix: Only special case single line item attribute suggestio… b89966e7f5b13b89bce8ba8ddd8dd98eb95e7997 (link)
#148264 reflect that type and const parameter can be intermixed 5a7f55f6f278d7dd0c094a1fa7fd16c3980167a9 (link)
#148363 Fix wasm_import_module attribute cross-crate 5b3fac457eeb4448583baf7fedbaaee9f777599a (link)
#148447 Tweak E0401 381595ecb140dea803cecfa663f0ae9e7c567629 (link)

previous master: 20383c9f1d

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

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 20383c9 (parent) -> 5f9dd05 (this PR)

Test differences

Show 38 test diffs

Stage 1

  • [ui] tests/ui/parser/let-chains-assign-add-incorrect.rs: [missing] -> pass (J1)
  • [ui] tests/ui/span/E0536.rs: pass -> [missing] (J1)
  • [ui] tests/ui/span/E0805.rs: [missing] -> pass (J1)
  • [ui] tests/ui/wasm/wasm-link-name-in-foreign-crate-respected.rs: [missing] -> ignore (only executed when the architecture is wasm32) (J1)

Stage 2

  • [ui] tests/ui/parser/let-chains-assign-add-incorrect.rs: [missing] -> pass (J0)
  • [ui] tests/ui/span/E0536.rs: pass -> [missing] (J0)
  • [ui] tests/ui/span/E0805.rs: [missing] -> pass (J0)
  • [ui] tests/ui/wasm/wasm-link-name-in-foreign-crate-respected.rs: [missing] -> ignore (only executed when the architecture is wasm32) (J0)

Additionally, 30 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 5f9dd05862d2e4bceb3be1031b6c936e35671501 --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. pr-check-1: 1482.8s -> 1914.3s (+29.1%)
  2. x86_64-rust-for-linux: 2620.4s -> 3132.5s (+19.5%)
  3. aarch64-gnu-llvm-20-2: 2131.0s -> 2526.4s (+18.6%)
  4. dist-aarch64-apple: 6996.5s -> 8072.3s (+15.4%)
  5. x86_64-gnu-llvm-21-3: 5679.4s -> 6478.0s (+14.1%)
  6. x86_64-gnu-gcc: 3085.6s -> 3492.8s (+13.2%)
  7. dist-apple-various: 3609.7s -> 3158.2s (-12.5%)
  8. armhf-gnu: 4589.6s -> 5139.0s (+12.0%)
  9. aarch64-apple: 8956.0s -> 9975.2s (+11.4%)
  10. x86_64-gnu-llvm-20: 2454.9s -> 2728.5s (+11.1%)
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.

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants