Remove StashKey::AssociatedTypeSuggestion - #162942
Open
nnethercote wants to merge 1 commit into
Open
nnethercote wants to merge 1 commit into
nnethercote wants to merge 1 commit into
Conversation
Collaborator
|
HIR ty lowering was modified cc @fmease |
davidtwco
approved these changes
Sep 23, 2026
Member
|
@bors r+ rollup |
Contributor
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 23, 2026
Rollup of 10 pull requests Successful merges: - #161988 (trait solver: Handle reflexive region constraints) - #162498 (Avoid ICEs when recovering malformed function parameters) - #163181 (revert #162715 due to #163149) - #163207 (Update deprecated rustc_hir imports 2) - #163216 (Add `inline` attribute to `NonZero::from_str`) - #120589 (std::thread::available_parallelism merging linux/android/freebsd version) - #162103 (fix(parser): emit targeted diagnostic for fields inside traits) - #162340 (When trying to recover from `for<…> dyn …` don't unconditionally treat `dyn` as a keyword) - #163094 (Add regression test for first token source file from TokenStream FromStr) - #163115 (Point at `'static` obligations from an fn being called) Failed merges: - #162942 (Remove `StashKey::AssociatedTypeSuggestion`)
This comment has been minimized.
This comment has been minimized.
Currently it's used in a really hacky way: a diagnostic with an empty message and some suggestions is stashed. Later on it might be retrieved and its suggestions extracted. It uses `Level::Allow` so that it isn't printed by `emit_stashed_diagnostics` at shutdown if it hasn't been retrieved. This isn't a normal stashed diagnostic, more just a case of "save some information that might be useful for diagnostics later". We can record the information more simply and directly. This commit adds `paths_matching_assoc_types` fields to `Resolver` and `ResolverGlobalCtxt`. These store the spans of the paths of interest. The new subdiagnostic `AssocTypeWithSameName` is used to construct the relevant suggestions when they are needed. Much nicer. The old approach removed the stashed diagnostic and the new approach doesn't remove the set entry, so a single span could conceivably match more than once, presumably a good thing, though this doesn't show up in the test suite.
nnethercote
force-pushed
the
rm-StashKey-AssociatedTypeSuggestion
branch
from
September 23, 2026 23:00
616089b to
1e185bd
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Contributor
Author
|
I rebased. @bors r=davidtwco |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Sep 23, 2026
…TypeSuggestion, r=davidtwco Remove `StashKey::AssociatedTypeSuggestion` Currently it's used in a really hacky way: a diagnostic with an empty message and some suggestions is stashed. Later on it might be retrieved and its suggestions extracted. It uses `Level::Allow` so that it isn't printed by `emit_stashed_diagnostics` at shutdown if it hasn't been retrieved. This isn't a normal stashed diagnostic, more just a case of "save some information that might be useful for diagnostics later". We can record the information more simply and directly. This commit adds `paths_matching_assoc_types` fields to `Resolver` and `ResolverGlobalCtxt`. These store the spans of the paths of interest. The new subdiagnostic `AssocTypeWithSameName` is used to construct the relevant suggestions when they are needed. Much nicer. The old approach removed the stashed diagnostic and the new approach doesn't remove the set entry, so a single span could conceivably match more than once, presumably a good thing, though this doesn't show up in the test suite. r? @davidtwco
This branch has not been deployed
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.
Currently it's used in a really hacky way: a diagnostic with an empty message and some suggestions is stashed. Later on it might be retrieved and its suggestions extracted. It uses
Level::Allowso that it isn't printed byemit_stashed_diagnosticsat shutdown if it hasn't been retrieved.This isn't a normal stashed diagnostic, more just a case of "save some information that might be useful for diagnostics later". We can record the information more simply and directly.
This commit adds
paths_matching_assoc_typesfields toResolverandResolverGlobalCtxt. These store the spans of the paths of interest. The new subdiagnosticAssocTypeWithSameNameis used to construct the relevant suggestions when they are needed. Much nicer. The old approach removed the stashed diagnostic and the new approach doesn't remove the set entry, so a single span could conceivably match more than once, presumably a good thing, though this doesn't show up in the test suite.r? @davidtwco