Files
rust/compiler/rustc_errors
Nicholas Nethercote 1e185bdebc 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.
2026-09-24 08:47:00 +10:00
..