Skip to content

Rollup of 5 pull requests#155611

Open
JonathanBrouwer wants to merge 17 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-hUV99y1
Open

Rollup of 5 pull requests#155611
JonathanBrouwer wants to merge 17 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-hUV99y1

Conversation

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Successful merges:

r? @ghost

Create a similar rollup

nnethercote and others added 17 commits April 20, 2026 10:13
The `Flags` trait has two methods: `flags` and `outer_exclusive_binder`.
Multiple types impl this trait and then also have duplicate inherent
methods with the same names; these are all marked with "Think about
removing this" comments. This is left over from things being moved into
`rustc_type_ir`.

This commit removes those inherent methods. This requires adding `use
Flags` to a number of files.
When a function returns `impl Trait`, all branches must return the same
concrete type. Previously, the compiler showed:

    expected `First` because of return type

This was misleading, as it suggested the return type was `First`, rather
than any single type implementing the trait.

Update the diagnostic to:

    expected a single type implementing `Value` because of return type

Also highlight the first return expression to make it clearer why
subsequent returns do not match.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
…ebank

Improve E0308 error message for `impl Trait` return mismatches

When a function returns `impl Trait`, all branches must return the same concrete type. Previously, the compiler showed:

    expected `First` because of return type

This was misleading, as it suggested the return type was `First`, rather than any single type implementing the trait.

Update the diagnostic to:

    expected a single type implementing `Value` because of return type

Also highlight the first return expression to make it clearer why subsequent returns do not match.
Fix incorrect `let` to `const` suggestion for pattern bindings

When a variable from a pattern binding was referenced inside a `const {}` block, the compiler incorrectly suggested replacing `let` with `const`. This was reported in rust-lang#152831 for `if let`, but also applies to `while let` and `let ... else`.
…r=nikomatsakis

Remove duplicated `Flags` methods.

The `Flags` trait has two methods: `flags` and `outer_exclusive_binder`. Multiple types impl this trait and then also have duplicate inherent methods with the same names; these are all marked with "Think about removing this" comments. This is left over from things being moved into `rustc_type_ir`.

This commit removes those inherent methods. This requires adding `use Flags` to a number of files.

r? @lcnr
…=oli-obk

Use per-parent disambiguators everywhere

This PR addressing the following concerns about per-parent disambiguators (rust-lang#153955):

- DisambiguatorState is removed, PerParentDisambiguatorState is now used everywhere,
- Steals were removed from every per-parent disambiguator in resolver,
- It adds `parent` field in `PerParentDisambiguatorState` in `#[cfg(debug_assertions)]` for asserting that per-parent disambiguator corresponds to the same `LocalDefId` which is passed into `create_def`,
- ~Removes `Disambiguator` trait replacing it with `Disambiguator` enum, with this change we no longer expose `next` method (as trait should be public otherwise the warning will be emitted). It may affect perf in a negative way though.~

~Those changes should not fix perf issues that were [reported](rust-lang#153955 (comment)), perf run that was attempted [before](rust-lang#153955 (comment)) showed much better results. Performance can be probably fixed by removing per-parent disambiguators replacing them with a single one as it was before, then it will be passed to AST -> HIR lowering and modified. For delayed owners we can store ~followup disambiguators as it was in the beginning of the rust-lang#153955~ per-parent disambiguators. This solution should save achievements from rust-lang#153955 (removed `DefPathData` variants).
However, I would prefer to keep per-parent disambiguators as it seems a better architectural solution for me.~

r? @petrochenkov
cc @oli-obk
…d, r=JonathanBrouwer

Remove AttributeLintKind variants - part 5

Part of rust-lang#153099.

r? @JonathanBrouwer
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Apr 21, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 21, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor Author

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

📌 Commit 79e2ff7 has been approved by JonathanBrouwer

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 Apr 21, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

⌛ Testing commit 79e2ff7 with merge f9988fe...

Workflow: https://github.com/rust-lang/rust/actions/runs/24752012610

rust-bors Bot pushed a commit that referenced this pull request Apr 21, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #155546 (Improve E0308 error message for `impl Trait` return mismatches)
 - #152834 (Fix incorrect `let` to `const` suggestion for pattern bindings)
 - #155425 (Remove duplicated `Flags` methods.)
 - #155547 (Use per-parent disambiguators everywhere)
 - #155590 (Remove AttributeLintKind variants - part 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants