Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 890e92f

Browse files
committedOct 17, 2023
Unify suggestion wording
1 parent 6cf01fc commit 890e92f

31 files changed

+145
-168
lines changed
 

‎compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
10181018
}
10191019
err.span_suggestions(
10201020
span,
1021-
"use the fully-qualified path",
1021+
"use fully-qualified syntax",
10221022
suggestions,
10231023
Applicability::MachineApplicable,
10241024
);
@@ -1190,7 +1190,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
11901190
} else {
11911191
err.span_suggestion_verbose(
11921192
span.with_hi(assoc_name.span.lo()),
1193-
"use fully qualified syntax to disambiguate",
1193+
"use fully-qualified syntax to disambiguate",
11941194
format!("<{ty_param_name} as {}>::", bound.print_only_trait_path()),
11951195
Applicability::MaybeIncorrect,
11961196
);

‎compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12601260
// Dynamic limit to avoid hiding just one candidate, which is silly.
12611261
let limit = if sources.len() == 5 { 5 } else { 4 };
12621262

1263+
let mut suggs = vec![];
12631264
for (idx, source) in sources.iter().take(limit).enumerate() {
12641265
match *source {
12651266
CandidateSource::Impl(impl_did) => {
@@ -1334,7 +1335,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13341335
.copied()
13351336
.unwrap_or(rcvr_ty),
13361337
};
1337-
print_disambiguation_help(
1338+
if let Some(sugg) = print_disambiguation_help(
13381339
item_name,
13391340
args,
13401341
err,
@@ -1347,7 +1348,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13471348
idx,
13481349
self.tcx.sess.source_map(),
13491350
item.fn_has_self_parameter,
1350-
);
1351+
) {
1352+
suggs.push(sugg);
1353+
}
13511354
}
13521355
}
13531356
CandidateSource::Trait(trait_did) => {
@@ -1371,7 +1374,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13711374
};
13721375
if let Some(sugg_span) = sugg_span {
13731376
let path = self.tcx.def_path_str(trait_did);
1374-
print_disambiguation_help(
1377+
if let Some(sugg) = print_disambiguation_help(
13751378
item_name,
13761379
args,
13771380
err,
@@ -1384,11 +1387,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13841387
idx,
13851388
self.tcx.sess.source_map(),
13861389
item.fn_has_self_parameter,
1387-
);
1390+
) {
1391+
suggs.push(sugg);
1392+
}
13881393
}
13891394
}
13901395
}
13911396
}
1397+
if !suggs.is_empty() && let Some(span) = sugg_span {
1398+
err.span_suggestions(
1399+
span.with_hi(item_name.span.lo()),
1400+
"use fully-qualified syntax to disambiguate",
1401+
suggs,
1402+
Applicability::MachineApplicable,
1403+
);
1404+
}
13921405
if sources.len() > limit {
13931406
err.note(format!("and {} others", sources.len() - limit));
13941407
}
@@ -3155,47 +3168,44 @@ fn print_disambiguation_help<'tcx>(
31553168
candidate: Option<usize>,
31563169
source_map: &source_map::SourceMap,
31573170
fn_has_self_parameter: bool,
3158-
) {
3159-
let mut applicability = Applicability::MachineApplicable;
3160-
let (span, sugg) = if let (
3161-
ty::AssocKind::Fn,
3162-
Some(MethodCallComponents { receiver, args, .. }),
3163-
) = (kind, args)
3164-
{
3165-
let args = format!(
3166-
"({}{})",
3167-
rcvr_ty.ref_mutability().map_or("", |mutbl| mutbl.ref_prefix_str()),
3168-
std::iter::once(receiver)
3169-
.chain(args.iter())
3170-
.map(|arg| source_map.span_to_snippet(arg.span).unwrap_or_else(|_| {
3171-
applicability = Applicability::HasPlaceholders;
3172-
"_".to_owned()
3173-
}))
3174-
.collect::<Vec<_>>()
3175-
.join(", "),
3176-
);
3177-
let trait_name = if !fn_has_self_parameter && let Some(impl_self_ty) = impl_self_ty {
3171+
) -> Option<String> {
3172+
Some(
3173+
if let (ty::AssocKind::Fn, Some(MethodCallComponents { receiver, args, .. })) = (kind, args)
3174+
{
3175+
let args = format!(
3176+
"({}{})",
3177+
rcvr_ty.ref_mutability().map_or("", |mutbl| mutbl.ref_prefix_str()),
3178+
std::iter::once(receiver)
3179+
.chain(args.iter())
3180+
.map(|arg| source_map
3181+
.span_to_snippet(arg.span)
3182+
.unwrap_or_else(|_| { "_".to_owned() }))
3183+
.collect::<Vec<_>>()
3184+
.join(", "),
3185+
);
3186+
let trait_name = if !fn_has_self_parameter && let Some(impl_self_ty) = impl_self_ty {
31783187
format!("<{impl_self_ty} as {trait_name}>")
31793188
} else {
31803189
trait_name
31813190
};
3182-
(span, format!("{trait_name}::{item_name}{args}"))
3183-
} else if let Some(impl_self_ty) = impl_self_ty {
3184-
(span.with_hi(item_name.span.lo()), format!("<{impl_self_ty} as {trait_name}>::"))
3185-
} else {
3186-
(span.with_hi(item_name.span.lo()), format!("{trait_name}::"))
3187-
};
3188-
err.span_suggestion_verbose(
3189-
span,
3190-
format!(
3191-
"disambiguate the {def_kind_descr} for {}",
3192-
if let Some(candidate) = candidate {
3193-
format!("candidate #{candidate}")
3194-
} else {
3195-
"the candidate".to_string()
3196-
},
3197-
),
3198-
sugg,
3199-
applicability,
3200-
);
3191+
err.span_suggestion_verbose(
3192+
span,
3193+
format!(
3194+
"disambiguate the {def_kind_descr} for {}",
3195+
if let Some(candidate) = candidate {
3196+
format!("candidate #{candidate}")
3197+
} else {
3198+
"the candidate".to_string()
3199+
},
3200+
),
3201+
format!("{trait_name}::{item_name}{args}"),
3202+
Applicability::HasPlaceholders,
3203+
);
3204+
return None;
3205+
} else if let Some(impl_self_ty) = impl_self_ty {
3206+
format!("<{impl_self_ty} as {trait_name}>::")
3207+
} else {
3208+
format!("{trait_name}::")
3209+
},
3210+
)
32013211
}

‎tests/ui/associated-consts/associated-const-ambiguity-report.stderr

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
1414
|
1515
LL | const ID: i32 = 3;
1616
| ^^^^^^^^^^^^^
17-
help: disambiguate the associated constant for candidate #1
18-
|
19-
LL | const X: i32 = <i32 as Foo>::ID;
20-
| ~~~~~~~~~~~~~~
21-
help: disambiguate the associated constant for candidate #2
17+
help: use fully-qualified syntax to disambiguate
2218
|
2319
LL | const X: i32 = <i32 as Bar>::ID;
2420
| ~~~~~~~~~~~~~~
21+
LL | const X: i32 = <i32 as Foo>::ID;
22+
| ~~~~~~~~~~~~~~
2523

2624
error: aborting due to previous error
2725

‎tests/ui/associated-inherent-types/issue-109071.no_gate.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ error[E0223]: ambiguous associated type
3333
--> $DIR/issue-109071.rs:15:22
3434
|
3535
LL | fn T() -> Option<Self::Item> {}
36-
| ^^^^^^^^^^ help: use the fully-qualified path: `<Windows<T> as IntoIterator>::Item`
36+
| ^^^^^^^^^^ help: use fully-qualified syntax: `<Windows<T> as IntoIterator>::Item`
3737

3838
error: aborting due to 4 previous errors
3939

‎tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12
33
|
44
LL | let _: S::<bool>::Pr = ();
5-
| ^^^^^^^^^^^^^ help: use the fully-qualified path: `<S<bool> as Tr>::Pr`
5+
| ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<S<bool> as Tr>::Pr`
66

77
error: aborting due to previous error
88

‎tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/ambiguous-associated-type-with-generics.rs:13:13
33
|
44
LL | let _x: <dyn Trait<i32>>::Ty;
5-
| ^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<dyn Trait<i32> as Assoc>::Ty`
5+
| ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<dyn Trait<i32> as Assoc>::Ty`
66

77
error: aborting due to previous error
88

‎tests/ui/associated-item/associated-item-duplicate-names-3.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0223]: ambiguous associated type
1313
--> $DIR/associated-item-duplicate-names-3.rs:18:12
1414
|
1515
LL | let x: Baz::Bar = 5;
16-
| ^^^^^^^^ help: use the fully-qualified path: `<Baz as Foo>::Bar`
16+
| ^^^^^^^^ help: use fully-qualified syntax: `<Baz as Foo>::Bar`
1717

1818
error: aborting due to 2 previous errors
1919

‎tests/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ LL | type Color;
1010
LL | fn a<C:Vehicle+Box>(_: C::Color) {
1111
| ^^^^^^^^ ambiguous associated type `Color`
1212
|
13-
help: use fully qualified syntax to disambiguate
13+
help: use fully-qualified syntax to disambiguate
1414
|
1515
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
1616
| ~~~~~~~~~~~~
17-
help: use fully qualified syntax to disambiguate
17+
help: use fully-qualified syntax to disambiguate
1818
|
1919
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
2020
| ~~~~~~~~~~~~~~~~
@@ -31,11 +31,11 @@ LL | type Color;
3131
LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
3232
| ^^^^^^^^ ambiguous associated type `Color`
3333
|
34-
help: use fully qualified syntax to disambiguate
34+
help: use fully-qualified syntax to disambiguate
3535
|
3636
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
3737
| ~~~~~~~~~~~~
38-
help: use fully qualified syntax to disambiguate
38+
help: use fully-qualified syntax to disambiguate
3939
|
4040
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
4141
| ~~~~~~~~~~~~~~~~
@@ -52,11 +52,11 @@ LL | type Color;
5252
LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
5353
| ^^^^^^^^ ambiguous associated type `Color`
5454
|
55-
help: use fully qualified syntax to disambiguate
55+
help: use fully-qualified syntax to disambiguate
5656
|
5757
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
5858
| ~~~~~~~~~~~~
59-
help: use fully qualified syntax to disambiguate
59+
help: use fully-qualified syntax to disambiguate
6060
|
6161
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
6262
| ~~~~~~~~~~~~~~~~
@@ -73,11 +73,11 @@ LL | type Color;
7373
LL | fn e(&self, _: X::Color) where X : Box;
7474
| ^^^^^^^^ ambiguous associated type `Color`
7575
|
76-
help: use fully qualified syntax to disambiguate
76+
help: use fully-qualified syntax to disambiguate
7777
|
7878
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
7979
| ~~~~~~~~~~~~
80-
help: use fully qualified syntax to disambiguate
80+
help: use fully-qualified syntax to disambiguate
8181
|
8282
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
8383
| ~~~~~~~~~~~~~~~~
@@ -94,11 +94,11 @@ LL | type Color;
9494
LL | fn f(&self, _: X::Color) where X : Box { }
9595
| ^^^^^^^^ ambiguous associated type `Color`
9696
|
97-
help: use fully qualified syntax to disambiguate
97+
help: use fully-qualified syntax to disambiguate
9898
|
9999
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
100100
| ~~~~~~~~~~~~
101-
help: use fully qualified syntax to disambiguate
101+
help: use fully-qualified syntax to disambiguate
102102
|
103103
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
104104
| ~~~~~~~~~~~~~~~~
@@ -115,11 +115,11 @@ LL | type Color;
115115
LL | fn d(&self, _: X::Color) where X : Box { }
116116
| ^^^^^^^^ ambiguous associated type `Color`
117117
|
118-
help: use fully qualified syntax to disambiguate
118+
help: use fully-qualified syntax to disambiguate
119119
|
120120
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
121121
| ~~~~~~~~~~~~
122-
help: use fully qualified syntax to disambiguate
122+
help: use fully-qualified syntax to disambiguate
123123
|
124124
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
125125
| ~~~~~~~~~~~~~~~~

‎tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ LL | type Color;
1818
LL | fn dent<C:BoxCar>(c: C, color: C::Color) {
1919
| ^^^^^^^^ ambiguous associated type `Color`
2020
|
21-
help: use fully qualified syntax to disambiguate
21+
help: use fully-qualified syntax to disambiguate
2222
|
2323
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
2424
| ~~~~~~~~~~~~~~~~
25-
help: use fully qualified syntax to disambiguate
25+
help: use fully-qualified syntax to disambiguate
2626
|
2727
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
2828
| ~~~~~~~~~~~~
@@ -71,11 +71,11 @@ LL | type Color;
7171
LL | fn paint<C:BoxCar>(c: C, d: C::Color) {
7272
| ^^^^^^^^ ambiguous associated type `Color`
7373
|
74-
help: use fully qualified syntax to disambiguate
74+
help: use fully-qualified syntax to disambiguate
7575
|
7676
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
7777
| ~~~~~~~~~~~~~~~~
78-
help: use fully qualified syntax to disambiguate
78+
help: use fully-qualified syntax to disambiguate
7979
|
8080
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
8181
| ~~~~~~~~~~~~

‎tests/ui/associated-types/associated-types-in-ambiguous-context.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ error[E0223]: ambiguous associated type
1313
--> $DIR/associated-types-in-ambiguous-context.rs:22:17
1414
|
1515
LL | trait Foo where Foo::Assoc: Bar {
16-
| ^^^^^^^^^^ help: use the fully-qualified path: `<Self as Foo>::Assoc`
16+
| ^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Foo>::Assoc`
1717

1818
error[E0223]: ambiguous associated type
1919
--> $DIR/associated-types-in-ambiguous-context.rs:27:10
2020
|
2121
LL | type X = std::ops::Deref::Target;
2222
| ^^^^^^^^^^^^^^^^^^^^^^^
2323
|
24-
help: use the fully-qualified path
24+
help: use fully-qualified syntax
2525
|
2626
LL | type X = <CString as Deref>::Target;
2727
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -37,7 +37,7 @@ error[E0223]: ambiguous associated type
3737
--> $DIR/associated-types-in-ambiguous-context.rs:13:23
3838
|
3939
LL | fn grab(&self) -> Grab::Value;
40-
| ^^^^^^^^^^^ help: use the fully-qualified path: `<Self as Grab>::Value`
40+
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
4141

4242
error[E0223]: ambiguous associated type
4343
--> $DIR/associated-types-in-ambiguous-context.rs:16:22

‎tests/ui/associated-types/associated-types-path-1.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ LL | type A;
1616
LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {}
1717
| ^^^^ ambiguous associated type `A`
1818
|
19-
help: use fully qualified syntax to disambiguate
19+
help: use fully-qualified syntax to disambiguate
2020
|
2121
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
2222
| ~~~~~~~~~~~~
23-
help: use fully qualified syntax to disambiguate
23+
help: use fully-qualified syntax to disambiguate
2424
|
2525
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
2626
| ~~~~~~~~~~~~

‎tests/ui/did_you_mean/bad-assoc-ty.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ error[E0223]: ambiguous associated type
191191
--> $DIR/bad-assoc-ty.rs:33:10
192192
|
193193
LL | type H = Fn(u8) -> (u8)::Output;
194-
| ^^^^^^^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
194+
| ^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn Fn(u8) -> u8 + 'static) as IntoFuture>::Output`
195195

196196
error[E0223]: ambiguous associated type
197197
--> $DIR/bad-assoc-ty.rs:39:19

‎tests/ui/error-codes/E0034.stderr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Tes
1414
|
1515
LL | fn foo() {}
1616
| ^^^^^^^^
17-
help: disambiguate the associated function for candidate #1
17+
help: use fully-qualified syntax to disambiguate
1818
|
1919
LL | <Test as Trait1>::foo()
2020
| ~~~~~~~~~~~~~~~~~~
21-
help: disambiguate the associated function for candidate #2
22-
|
2321
LL | <Test as Trait2>::foo()
2422
| ~~~~~~~~~~~~~~~~~~
2523

‎tests/ui/error-codes/E0221.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ LL | fn do_something() {
1010
LL | let _: Self::A;
1111
| ^^^^^^^ ambiguous associated type `A`
1212
|
13-
help: use fully qualified syntax to disambiguate
13+
help: use fully-qualified syntax to disambiguate
1414
|
1515
LL | let _: <Self as Foo>::A;
1616
| ~~~~~~~~~~~~~~~
17-
help: use fully qualified syntax to disambiguate
17+
help: use fully-qualified syntax to disambiguate
1818
|
1919
LL | let _: <Self as Bar>::A;
2020
| ~~~~~~~~~~~~~~~
@@ -29,7 +29,7 @@ LL | let _: Self::Err;
2929
| ^^^^^^^^^ ambiguous associated type `Err`
3030
|
3131
= note: associated type `Self` could derive from `FromStr`
32-
help: use fully qualified syntax to disambiguate
32+
help: use fully-qualified syntax to disambiguate
3333
|
3434
LL | let _: <Self as My>::Err;
3535
| ~~~~~~~~~~~~~~

‎tests/ui/error-codes/E0223.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/E0223.rs:8:14
33
|
44
LL | let foo: MyTrait::X;
5-
| ^^^^^^^^^^ help: use the fully-qualified path: `<MyStruct as MyTrait>::X`
5+
| ^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as MyTrait>::X`
66

77
error: aborting due to previous error
88

‎tests/ui/lint/bare-trait-objects-path.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0223]: ambiguous associated type
1616
--> $DIR/bare-trait-objects-path.rs:23:12
1717
|
1818
LL | let _: Dyn::Ty;
19-
| ^^^^^^^ help: use the fully-qualified path: `<dyn Dyn as Assoc>::Ty`
19+
| ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Assoc>::Ty`
2020

2121
warning: trait objects without an explicit `dyn` are deprecated
2222
--> $DIR/bare-trait-objects-path.rs:14:5

‎tests/ui/methods/disambiguate-multiple-blanket-impl.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ fn main() {
2929
let s = S;
3030
S::foo(&s); //~ ERROR multiple applicable items in scope
3131
//~^ NOTE multiple `foo` found
32-
//~| HELP disambiguate
33-
//~| HELP disambiguate
32+
//~| HELP use fully-qualified syntax to disambiguate
3433
S::CONST; //~ ERROR multiple applicable items in scope
3534
//~^ NOTE multiple `CONST` found
36-
//~| HELP disambiguate
37-
//~| HELP disambiguate
35+
//~| HELP use fully-qualified syntax to disambiguate
3836
let _: S::Type; //~ ERROR ambiguous associated type
39-
//~^ HELP use the fully-qualified path
37+
//~^ HELP use fully-qualified syntax
4038
}

‎tests/ui/methods/disambiguate-multiple-blanket-impl.stderr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0223]: ambiguous associated type
2-
--> $DIR/disambiguate-multiple-blanket-impl.rs:38:12
2+
--> $DIR/disambiguate-multiple-blanket-impl.rs:36:12
33
|
44
LL | let _: S::Type;
55
| ^^^^^^^
66
|
7-
help: use the fully-qualified path
7+
help: use fully-qualified syntax
88
|
99
LL | let _: <S as A>::Type;
1010
| ~~~~~~~~~~~~~~
@@ -27,17 +27,15 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `T`
2727
|
2828
LL | fn foo(&self) {}
2929
| ^^^^^^^^^^^^^
30-
help: disambiguate the method for candidate #1
30+
help: use fully-qualified syntax to disambiguate
3131
|
3232
LL | <T as A>::foo(&s);
3333
| ~~~~~~~~~~
34-
help: disambiguate the method for candidate #2
35-
|
3634
LL | <T as B>::foo(&s);
3735
| ~~~~~~~~~~
3836

3937
error[E0034]: multiple applicable items in scope
40-
--> $DIR/disambiguate-multiple-blanket-impl.rs:34:8
38+
--> $DIR/disambiguate-multiple-blanket-impl.rs:33:8
4139
|
4240
LL | S::CONST;
4341
| ^^^^^ multiple `CONST` found
@@ -52,12 +50,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `T`
5250
|
5351
LL | const CONST: usize = 2;
5452
| ^^^^^^^^^^^^^^^^^^
55-
help: disambiguate the associated constant for candidate #1
53+
help: use fully-qualified syntax to disambiguate
5654
|
5755
LL | <T as A>::CONST;
5856
| ~~~~~~~~~~
59-
help: disambiguate the associated constant for candidate #2
60-
|
6157
LL | <T as B>::CONST;
6258
| ~~~~~~~~~~
6359

‎tests/ui/methods/disambiguate-multiple-impl.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ fn main() {
2828
let s = S;
2929
S::foo(&s); //~ ERROR multiple applicable items in scope
3030
//~^ NOTE multiple `foo` found
31-
//~| HELP disambiguate
32-
//~| HELP disambiguate
31+
//~| HELP use fully-qualified syntax
3332
let _: S::Type = (); //~ ERROR ambiguous associated type
34-
//~| HELP use the fully-qualified path
33+
//~| HELP use fully-qualified syntax
3534
let _ = S::CONST; //~ ERROR multiple applicable items in scope
3635
//~^ NOTE multiple `CONST` found
37-
//~| HELP disambiguate
38-
//~| HELP disambiguate
36+
//~| HELP use fully-qualified syntax
3937
}

‎tests/ui/methods/disambiguate-multiple-impl.stderr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0223]: ambiguous associated type
2-
--> $DIR/disambiguate-multiple-impl.rs:33:12
2+
--> $DIR/disambiguate-multiple-impl.rs:32:12
33
|
44
LL | let _: S::Type = ();
55
| ^^^^^^^
66
|
7-
help: use the fully-qualified path
7+
help: use fully-qualified syntax
88
|
99
LL | let _: <S as A>::Type = ();
1010
| ~~~~~~~~~~~~~~
@@ -27,17 +27,15 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `S`
2727
|
2828
LL | fn foo(&self) {}
2929
| ^^^^^^^^^^^^^
30-
help: disambiguate the method for candidate #1
30+
help: use fully-qualified syntax to disambiguate
3131
|
3232
LL | <S as A>::foo(&s);
3333
| ~~~~~~~~~~
34-
help: disambiguate the method for candidate #2
35-
|
3634
LL | <S as B>::foo(&s);
3735
| ~~~~~~~~~~
3836

3937
error[E0034]: multiple applicable items in scope
40-
--> $DIR/disambiguate-multiple-impl.rs:35:16
38+
--> $DIR/disambiguate-multiple-impl.rs:34:16
4139
|
4240
LL | let _ = S::CONST;
4341
| ^^^^^ multiple `CONST` found
@@ -52,12 +50,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `S`
5250
|
5351
LL | const CONST: usize = 2;
5452
| ^^^^^^^^^^^^^^^^^^
55-
help: disambiguate the associated constant for candidate #1
53+
help: use fully-qualified syntax to disambiguate
5654
|
5755
LL | let _ = <S as A>::CONST;
5856
| ~~~~~~~~~~
59-
help: disambiguate the associated constant for candidate #2
60-
|
6157
LL | let _ = <S as B>::CONST;
6258
| ~~~~~~~~~~
6359

‎tests/ui/methods/disambiguate-multiple-trait-2.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ fn a<T: C>(t: T) {
1919
//~| HELP disambiguate the method
2020
let _ = T::CONST; //~ ERROR multiple applicable items in scope
2121
//~^ NOTE multiple `CONST` found
22-
//~| HELP disambiguate
23-
//~| HELP disambiguate
22+
//~| HELP use fully-qualified syntax
2423
let _: T::Type; //~ ERROR ambiguous associated type
2524
//~^ NOTE ambiguous associated type `Type`
26-
//~| HELP use fully qualified syntax
27-
//~| HELP use fully qualified syntax
25+
//~| HELP use fully-qualified syntax
26+
//~| HELP use fully-qualified syntax
2827
}
2928

3029
#[derive(Debug)]
@@ -46,12 +45,10 @@ fn main() {
4645
let s = S;
4746
S::foo(&s); //~ ERROR multiple applicable items in scope
4847
//~^ NOTE multiple `foo` found
49-
//~| HELP disambiguate
50-
//~| HELP disambiguate
48+
//~| HELP use fully-qualified syntax
5149
let _ = S::CONST; //~ ERROR multiple applicable items in scope
5250
//~^ NOTE multiple `CONST` found
53-
//~| HELP disambiguate
54-
//~| HELP disambiguate
51+
//~| HELP use fully-qualified syntax
5552
let _: S::Type; //~ ERROR ambiguous associated type
56-
//~^ HELP use the fully-qualified path
53+
//~^ HELP use fully-qualified syntax
5754
}

‎tests/ui/methods/disambiguate-multiple-trait-2.stderr

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0221]: ambiguous associated type `Type` in bounds of `T`
2-
--> $DIR/disambiguate-multiple-trait-2.rs:24:12
2+
--> $DIR/disambiguate-multiple-trait-2.rs:23:12
33
|
44
LL | type Type;
55
| --------- ambiguous `Type` from `A`
@@ -10,11 +10,11 @@ LL | type Type;
1010
LL | let _: T::Type;
1111
| ^^^^^^^ ambiguous associated type `Type`
1212
|
13-
help: use fully qualified syntax to disambiguate
13+
help: use fully-qualified syntax to disambiguate
1414
|
1515
LL | let _: <T as A>::Type;
1616
| ~~~~~~~~~~
17-
help: use fully qualified syntax to disambiguate
17+
help: use fully-qualified syntax to disambiguate
1818
|
1919
LL | let _: <T as B>::Type;
2020
| ~~~~~~~~~~
@@ -60,75 +60,69 @@ note: candidate #2 is defined in the trait `B`
6060
|
6161
LL | const CONST: usize;
6262
| ^^^^^^^^^^^^^^^^^^
63-
help: disambiguate the associated constant for candidate #1
63+
help: use fully-qualified syntax to disambiguate
6464
|
6565
LL | let _ = A::CONST;
6666
| ~~~
67-
help: disambiguate the associated constant for candidate #2
68-
|
6967
LL | let _ = B::CONST;
7068
| ~~~
7169

7270
error[E0223]: ambiguous associated type
73-
--> $DIR/disambiguate-multiple-trait-2.rs:55:12
71+
--> $DIR/disambiguate-multiple-trait-2.rs:52:12
7472
|
7573
LL | let _: S::Type;
7674
| ^^^^^^^
7775
|
78-
help: use the fully-qualified path
76+
help: use fully-qualified syntax
7977
|
8078
LL | let _: <S as A>::Type;
8179
| ~~~~~~~~~~~~~~
8280
LL | let _: <S as B>::Type;
8381
| ~~~~~~~~~~~~~~
8482

8583
error[E0034]: multiple applicable items in scope
86-
--> $DIR/disambiguate-multiple-trait-2.rs:47:8
84+
--> $DIR/disambiguate-multiple-trait-2.rs:46:8
8785
|
8886
LL | S::foo(&s);
8987
| ^^^ multiple `foo` found
9088
|
9189
note: candidate #1 is defined in an impl of the trait `A` for the type `T`
92-
--> $DIR/disambiguate-multiple-trait-2.rs:36:5
90+
--> $DIR/disambiguate-multiple-trait-2.rs:35:5
9391
|
9492
LL | fn foo(&self) {}
9593
| ^^^^^^^^^^^^^
9694
note: candidate #2 is defined in an impl of the trait `B` for the type `T`
97-
--> $DIR/disambiguate-multiple-trait-2.rs:42:5
95+
--> $DIR/disambiguate-multiple-trait-2.rs:41:5
9896
|
9997
LL | fn foo(&self) {}
10098
| ^^^^^^^^^^^^^
101-
help: disambiguate the method for candidate #1
99+
help: use fully-qualified syntax to disambiguate
102100
|
103101
LL | <T as A>::foo(&s);
104102
| ~~~~~~~~~~
105-
help: disambiguate the method for candidate #2
106-
|
107103
LL | <T as B>::foo(&s);
108104
| ~~~~~~~~~~
109105

110106
error[E0034]: multiple applicable items in scope
111-
--> $DIR/disambiguate-multiple-trait-2.rs:51:16
107+
--> $DIR/disambiguate-multiple-trait-2.rs:49:16
112108
|
113109
LL | let _ = S::CONST;
114110
| ^^^^^ multiple `CONST` found
115111
|
116112
note: candidate #1 is defined in an impl of the trait `A` for the type `T`
117-
--> $DIR/disambiguate-multiple-trait-2.rs:35:5
113+
--> $DIR/disambiguate-multiple-trait-2.rs:34:5
118114
|
119115
LL | const CONST: usize = 1;
120116
| ^^^^^^^^^^^^^^^^^^
121117
note: candidate #2 is defined in an impl of the trait `B` for the type `T`
122-
--> $DIR/disambiguate-multiple-trait-2.rs:41:5
118+
--> $DIR/disambiguate-multiple-trait-2.rs:40:5
123119
|
124120
LL | const CONST: usize = 1;
125121
| ^^^^^^^^^^^^^^^^^^
126-
help: disambiguate the associated constant for candidate #1
122+
help: use fully-qualified syntax to disambiguate
127123
|
128124
LL | let _ = <T as A>::CONST;
129125
| ~~~~~~~~~~
130-
help: disambiguate the associated constant for candidate #2
131-
|
132126
LL | let _ = <T as B>::CONST;
133127
| ~~~~~~~~~~
134128

‎tests/ui/methods/disambiguate-multiple-trait.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ fn main() {
2323
let s = S;
2424
S::foo(&s); //~ ERROR multiple applicable items in scope
2525
//~^ NOTE multiple `foo` found
26-
//~| HELP disambiguate
27-
//~| HELP disambiguate
26+
//~| HELP use fully-qualified syntax
2827
let _ = S::CONST; //~ ERROR multiple applicable items in scope
2928
//~^ NOTE multiple `CONST` found
30-
//~| HELP disambiguate
31-
//~| HELP disambiguate
29+
//~| HELP use fully-qualified syntax
3230
let _: S::Type; //~ ERROR ambiguous associated type
33-
//~^ HELP use the fully-qualified path
31+
//~^ HELP use fully-qualified syntax
3432
}

‎tests/ui/methods/disambiguate-multiple-trait.stderr

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0223]: ambiguous associated type
2-
--> $DIR/disambiguate-multiple-trait.rs:32:12
2+
--> $DIR/disambiguate-multiple-trait.rs:30:12
33
|
44
LL | let _: S::Type;
55
| ^^^^^^^
66
|
7-
help: use the fully-qualified path
7+
help: use fully-qualified syntax
88
|
99
LL | let _: <S as A>::Type;
1010
| ~~~~~~~~~~~~~~
@@ -27,17 +27,15 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `T`
2727
|
2828
LL | fn foo(&self) {}
2929
| ^^^^^^^^^^^^^
30-
help: disambiguate the method for candidate #1
30+
help: use fully-qualified syntax to disambiguate
3131
|
3232
LL | <T as A>::foo(&s);
3333
| ~~~~~~~~~~
34-
help: disambiguate the method for candidate #2
35-
|
3634
LL | <T as B>::foo(&s);
3735
| ~~~~~~~~~~
3836

3937
error[E0034]: multiple applicable items in scope
40-
--> $DIR/disambiguate-multiple-trait.rs:28:16
38+
--> $DIR/disambiguate-multiple-trait.rs:27:16
4139
|
4240
LL | let _ = S::CONST;
4341
| ^^^^^ multiple `CONST` found
@@ -52,12 +50,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `T`
5250
|
5351
LL | const CONST: usize = 2;
5452
| ^^^^^^^^^^^^^^^^^^
55-
help: disambiguate the associated constant for candidate #1
53+
help: use fully-qualified syntax to disambiguate
5654
|
5755
LL | let _ = <T as A>::CONST;
5856
| ~~~~~~~~~~
59-
help: disambiguate the associated constant for candidate #2
60-
|
6157
LL | let _ = <T as B>::CONST;
6258
| ~~~~~~~~~~
6359

‎tests/ui/methods/method-ambig-two-traits-from-impls2.stderr

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ note: candidate #2 is defined in an impl of the trait `B` for the type `AB`
1414
|
1515
LL | fn foo() {}
1616
| ^^^^^^^^
17-
help: disambiguate the associated function for candidate #1
17+
help: use fully-qualified syntax to disambiguate
1818
|
1919
LL | <AB as A>::foo();
2020
| ~~~~~~~~~~~
21-
help: disambiguate the associated function for candidate #2
22-
|
2321
LL | <AB as B>::foo();
2422
| ~~~~~~~~~~~
2523

‎tests/ui/self/self-impl.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ error[E0223]: ambiguous associated type
22
--> $DIR/self-impl.rs:23:16
33
|
44
LL | let _: <Self>::Baz = true;
5-
| ^^^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
5+
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
66

77
error[E0223]: ambiguous associated type
88
--> $DIR/self-impl.rs:25:16
99
|
1010
LL | let _: Self::Baz = true;
11-
| ^^^^^^^^^ help: use the fully-qualified path: `<Bar as Foo>::Baz`
11+
| ^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
1212

1313
error: aborting due to 2 previous errors
1414

‎tests/ui/structs/struct-path-associated-type.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ error[E0223]: ambiguous associated type
4848
--> $DIR/struct-path-associated-type.rs:32:13
4949
|
5050
LL | let s = S::A {};
51-
| ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
51+
| ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
5252

5353
error[E0223]: ambiguous associated type
5454
--> $DIR/struct-path-associated-type.rs:33:13
5555
|
5656
LL | let z = S::A::<u8> {};
57-
| ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
57+
| ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
5858

5959
error[E0223]: ambiguous associated type
6060
--> $DIR/struct-path-associated-type.rs:35:9
6161
|
6262
LL | S::A {} => {}
63-
| ^^^^ help: use the fully-qualified path: `<S as Tr>::A`
63+
| ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
6464

6565
error: aborting due to 8 previous errors
6666

‎tests/ui/suggestions/suggest-trait-in-ufcs-in-hrtb.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/suggest-trait-in-ufcs-in-hrtb.rs:5:38
33
|
44
LL | impl<S> Foo for Bar<S> where for<'a> <&'a S>::Item: Foo {}
5-
| ^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'a S as IntoIterator>::Item`
5+
| ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'a S as IntoIterator>::Item`
66

77
error: aborting due to previous error
88

‎tests/ui/traits/item-privacy.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ error[E0223]: ambiguous associated type
159159
--> $DIR/item-privacy.rs:116:12
160160
|
161161
LL | let _: S::B;
162-
| ^^^^ help: use the fully-qualified path: `<S as assoc_ty::B>::B`
162+
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
163163

164164
error[E0223]: ambiguous associated type
165165
--> $DIR/item-privacy.rs:117:12
166166
|
167167
LL | let _: S::C;
168-
| ^^^^ help: use the fully-qualified path: `<S as assoc_ty::C>::C`
168+
| ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
169169

170170
error[E0624]: associated type `A` is private
171171
--> $DIR/item-privacy.rs:119:12

‎tests/ui/typeck/issue-107087.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/issue-107087.rs:16:5
33
|
44
LL | A::B::<>::C
5-
| ^^^^^^^^ help: use the fully-qualified path: `<A<_> as Foo>::B`
5+
| ^^^^^^^^ help: use fully-qualified syntax: `<A<_> as Foo>::B`
66

77
error: aborting due to previous error
88

‎tests/ui/typeck/issue-110052.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0223]: ambiguous associated type
22
--> $DIR/issue-110052.rs:6:30
33
|
44
LL | for<'iter> dyn Validator<<&'iter I>::Item>:,
5-
| ^^^^^^^^^^^^^^^^ help: use the fully-qualified path: `<&'iter I as IntoIterator>::Item`
5+
| ^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<&'iter I as IntoIterator>::Item`
66

77
error: aborting due to previous error
88

0 commit comments

Comments
 (0)
Please sign in to comment.