rust/compiler/rustc_resolve/src
Dylan DPC 3143472863
Rollup merge of #103560 - zbyrn:issue-103358-fix, r=cjgillot
Point only to the identifiers in the typo suggestions of shadowed names instead of the entire struct

Fixes #103358.

As discussed in the issue, the `Span` of the candidate `Ident` for a typo replacement is stored alongside its `Symbol` in `TypoSuggestion`. Then, the span of the identifier is what the "you might have meant to refer to" note is pointed at, rather than the entire struct definition.

Comments in #103111 and the issue both suggest that it is desirable to:
1. include names defined in the same crate as the typo,
2. ignore names defined elsewhere such as in `std`, _and_
3. include names introduced indirectly via `use`.

Since a name from another crate but introduced via `use` has non-local `def_id`, to achieve this, a suggestion is displayed if either the `def_id` of the suggested name is local, or the `span` of the suggested name is in the same file as the typo itself.

Some UI tests have also been modified to reflect this change.

r? `@cjgillot`
2022-10-30 11:50:26 +05:30
..
diagnostics Implement the unused_macro_rules lint 2022-05-05 19:13:00 +02:00
late Rollup merge of #103560 - zbyrn:issue-103358-fix, r=cjgillot 2022-10-30 11:50:26 +05:30
build_reduced_graph.rs rustc_hir: Less error-prone methods for accessing PartialRes resolution 2022-10-11 09:04:52 +04:00
check_unused.rs rustc_typeck to rustc_hir_analysis 2022-09-27 10:37:23 +02:00
def_collector.rs Rename AssocItemKind::TyAlias to AssocItemKind::Type 2022-10-10 02:31:37 +00:00
diagnostics.rs Add Span in TypoSuggestion and TypoCandidate 2022-10-25 22:08:41 -05:00
effective_visibilities.rs privacy: Rename "accessibility levels" to "effective visibilities" 2022-10-26 16:34:53 +04:00
ident.rs Shrink hir::def::Res. 2022-09-29 08:44:52 +10:00
imports.rs resolve: Revert "Set effective visibilities for imports more precisely" 2022-10-19 18:42:47 +04:00
late.rs Auto merge of #103450 - cjgillot:elision-nodedup, r=Mark-Simulacrum 2022-10-29 17:32:45 +00:00
lib.rs Only ban duplication across parameters. 2022-10-27 19:04:48 +00:00
macros.rs fix span for suggestion 2022-10-20 11:55:30 +08:00