Rollup of 5 pull requests#155611
Open
JonathanBrouwer wants to merge 17 commits intorust-lang:mainfrom
Open
Conversation
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>
…and not the old one
…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
Contributor
Author
|
@bors r+ rollup=never p=5 |
Contributor
Contributor
|
⌛ 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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
impl Traitreturn mismatches #155546 (Improve E0308 error message forimpl Traitreturn mismatches)lettoconstsuggestion for pattern bindings #152834 (Fix incorrectlettoconstsuggestion for pattern bindings)Flagsmethods. #155425 (Remove duplicatedFlagsmethods.)r? @ghost
Create a similar rollup