Skip to content

Rollup of 10 pull requests - #165312

Closed
jhpratt wants to merge 27 commits into
rust-lang:mainfrom
jhpratt:rollup-qwun6FV
Closed

jhpratt wants to merge 27 commits into
rust-lang:mainfrom
jhpratt:rollup-qwun6FV

Conversation

@jhpratt

@jhpratt jhpratt commented Nov 2, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

estebank and others added 27 commits September 20, 2026 03:13
```
error[E0425]: cannot find function `bar` in this scope
  --> $DIR/suggest-self-2.rs:9:9
   |
LL |         bar(&&self, 102);
   |         ^^^
   |
help: try calling `bar` as a method
   |
LL -         bar(&&self, 102);
LL +         self.bar(102);
   |
```
The old message, “help: use `let _ = ...` to ignore the resulting
value” (or its variation with `let _unused` for `needs_drop` values),
contains no indication that this is something that you might not want
to do, and in fact can be read as saying that one *should* do this.

The new message, “if you wish to disregard this recommendation, use
`let _ = ...` to ignore the value”, is intended to make it clear that
this is a choice.
Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (`feature(never_patterns)`].

```
error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |
```
* Add regression test
* Recover inner attributes in algebraic data types
* Try to recover after every field and variant
We should not forbid users from experimenting on their own forks.

https://x.com/0xalpharush/status/2116964999000478125
… r=fmease

Recover inner attributes in algebraic data types

Previously, if you'd put an inner attribute in an empty ADT, such as a struct:
```rust
struct Test1 {
    #![inline]
}
```
You'd get the following errors
```
error: an inner attribute is not permitted in this context
 --> src/lib.rs:5:5
  |
5 |     #![cfg(false)]
  |     ^^^^^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
  = note: outer attributes, like `#[test]`, annotate the item following them

error: expected identifier, found `}`
 --> src/lib.rs:6:1
  |
4 | struct Test3 {
  |        ----- while parsing this struct
5 |     #![cfg(false)]
6 | }
  | ^ expected identifier

error: could not compile `rust-test` (lib) due to 2 previous errors
```

The second error is spurious. It was caused by us only recovering inner attributes just before parsing a field, meaning if we see an inner attribute and recover we expect a field next. This PR fixes that by recovering inner attributes just after the curly brace as well.
Make the suggestion message of `unused_must_use` scarier.

The old message, “help: use `let _ = ...` to ignore the resulting value”, contains no indication that this is something that you might not want to do, and in fact can be read as saying that one *should* do this.

The new message, “help: if you wish to disregard this recommendation and immediately drop the value, use `let _ = ...`”, is intended to make it clear that this is a choice, and choosing it has the particular effect of immediately dropping the value.

A possible further improvement, not part of this change, might be to distinguish between types that are `must_use` and have a destructor (whose side-effects are likely relevant), and types that are `must_use` and do not have a destructor, where the timing is irrelevant and the consequence is just ignoring information that was provided. However, not every destructor is relevant to `must_use`; for example, `Result<(), Box<dyn Error>>` has a destructor and is `must_use`, but the destructor is only managing memory for the error value and it has no side effects relevant to the caller (unless the error in the box has side effects of its own).

Inspired by [#t-lang > Lint for assigning drop guards to _](https://rust-lang.zulipchat.com/#narrow/channel/213817-t-lang/topic/Lint.20for.20assigning.20drop.20guards.20to.20_/with/624036822)

@rustbot label +A-lints +L-unused_must_use
…mease

Use verbose suggestion for type literal with wrong syntax

```
error[E0423]: cannot find value `StructWithFields` in crate `xcrate_unit_struct`
  --> $DIR/unit-struct.rs:9:33
   |
LL |     let _ = xcrate_unit_struct::StructWithFields;
   |                                 ^^^^^^^^^^^^^^^^
   |
  ::: $DIR/auxiliary/xcrate_unit_struct.rs:20:1
   |
LL | pub struct StructWithFields {
   | --------------------------- `xcrate_unit_struct::StructWithFields` defined here
   |
   = note: a struct named `xcrate_unit_struct::StructWithFields` exists in another namespace
help: use struct literal syntax instead
   |
LL |     let _ = xcrate_unit_struct::StructWithFields { foo: val };
   |                                                  ++++++++++++
```
```
error[E0532]: expected tuple struct or tuple variant, found unit variant `Color::NoColor`
  --> $DIR/match-pattern-field-mismatch-2.rs:12:11
   |
LL | enum Color {
LL |         NoColor,
   |         ------- `Color::NoColor` defined here
...
LL |           Color::NoColor(_) => { }
   |           ^^^^^^^^^^^^^^^^^
   |
help: use the unit struct syntax instead
   |
LL -           Color::NoColor(_) => { }
LL +           Color::NoColor => { }
   |
```
…tern-comma-suggestion, r=fmease

Fix multiple pattern comma suggestions in diagnostics

`skip_pat_list` and `recover_unexpected_comma` is on cold path,
so there will be no perf issue here.
…d-qualifications-wildcard, r=fmease

Don't lint unused_qualifications when the unqualified path is ambiguous

Fixes rust-lang#163310
… r=fmease

Tweak suggestion of "unreachable due to never pattern"

Use more accurate span when suggesting to remove guard and body of a never-pattern match arm (`feature(never_patterns)`].

```
error: a guard on a never pattern will never be run
  --> $DIR/ICE-119271-never-arm-attr-in-guard.rs:8:13
   |
LL |             false
   |             ^^^^^
   |
help: remove the guard, leaving only the pattern
   |
LL -         Some(!)
LL -
LL -             if #[deny(unused_mut)]
LL -             false
LL +         Some(!)
   |
```
Improve span for unused_mut lint

Closes rust-lang#165269

I basically used trim to avoid the overlap of spans mentioned on the issue. I kept the whitespace in the "mut" span since the fix removes the whole span and not removing the whitespace would mean for uglier code after fix.

If this is really important, I could add an extra span to the diagnostic struct, but I'll wait on feedback.
…gjubilee

Forward `AbiAlign` `Debug` impl to `Align`

The `Debug` output of `AbiAlign` shows up in UI test stderr output via `LayoutData`. The first commit of this PR changes `Debug` impl of `AbiAlign` to directly forward to `Align`, meaning that the future change from `AbiAlign` to `Align` won't affect test output. The second commit removes unused `//@ normalize-stderr` directives for preferred alignment. Commits are easiest to review individually - most of the changes are just blessing tests.

r? @workingjubilee
…ecks-desc, r=chenyukang

unstable.rs: add missing `]` in description of `cfg_ub_checks`
…=jieyouxu

Clarify AGENTS.md around pushing to a fork

We should not forbid users from experimenting on their own forks.

https://x.com/0xalpharush/status/2116964999000478125

r? @jyn514
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Nov 2, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 2, 2026
@jhpratt

jhpratt commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@bors r+ p=5 force

@rust-bors

rust-bors Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d43efb2 has been approved by jhpratt

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 Nov 2, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_public_bridge v0.0.0 (/checkout/compiler/rustc_public_bridge)
error[E0599]: no method named `eq_ctxt` found for struct `rustc_span::Span` in the current scope
   --> compiler/rustc_ast_lowering/src/expr.rs:820:43
    |
820 |             let remove_span = if arm.span.eq_ctxt(arm.pat.span) {
    |                                           ^^^^^^^
    |
help: there is a method `ctxt` with a similar name, but with different arguments
   --> compiler/rustc_span/src/span_encoding.rs:516:5
    |

@jhpratt jhpratt closed this Nov 2, 2026
@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 Nov 2, 2026
@jhpratt
jhpratt deleted the rollup-qwun6FV branch November 2, 2026 02:23
@rust-bors

rust-bors Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

PR #163764, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

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

Labels

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