Skip to content

Commit a62bfcd

Browse files
committed
Use verbose format for fully-qualified path suggestion
1 parent 88ccfa4 commit a62bfcd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_data_structures::sorted_map::SortedMap;
1515
use rustc_data_structures::unord::UnordSet;
1616
use rustc_errors::{
1717
codes::*, pluralize, struct_span_code_err, Applicability, Diag, MultiSpan, StashKey,
18+
SuggestionStyle,
1819
};
1920
use rustc_hir::def::DefKind;
2021
use rustc_hir::def_id::DefId;
@@ -1949,11 +1950,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
19491950
&& let Some(span) = sugg_span
19501951
{
19511952
suggs.sort();
1952-
err.span_suggestions(
1953+
err.span_suggestions_with_style(
19531954
span.with_hi(item_name.span.lo()),
19541955
"use fully-qualified syntax to disambiguate",
19551956
suggs,
19561957
Applicability::MachineApplicable,
1958+
SuggestionStyle::ShowAlways,
19571959
);
19581960
}
19591961
if sources.len() > limit {

tests/ui/dyn-keyword/trait-dyn-in-qualified-path-with-collision.stderr

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ error[E0034]: multiple applicable items in scope
22
--> $DIR/trait-dyn-in-qualified-path-with-collision.rs:9:18
33
|
44
LL | <dyn Trait>::function(&());
5-
| -------------^^^^^^^^ multiple `function` found
6-
| |
7-
| help: use fully-qualified syntax to disambiguate: `Trait::`
5+
| ^^^^^^^^ multiple `function` found
86
|
97
note: candidate #1 is defined in the trait `Trait`
108
--> $DIR/trait-dyn-in-qualified-path-with-collision.rs:2:5
@@ -16,6 +14,10 @@ note: candidate #2 is defined in an impl for the type `(dyn Trait + 'static)`
1614
|
1715
LL | fn function(&self) {}
1816
| ^^^^^^^^^^^^^^^^^^
17+
help: use fully-qualified syntax to disambiguate
18+
|
19+
LL | Trait::function(&());
20+
| ~~~~~~~
1921

2022
error: aborting due to 1 previous error
2123

0 commit comments

Comments
 (0)