Fix case in associated-type-projection-from-multiple-supertraits.rs
This still doesn't handle the case entirely correctly, requiring a more targeted approach with a better suggestion, but at least now the suggested syntax makes *some* sense.
This commit is contained in:
parent
547abe0c52
commit
759df5fa35
@ -937,6 +937,7 @@ pub(super) fn instantiate_poly_trait_ref_inner(
|
||||
bounds,
|
||||
speculative,
|
||||
&mut dup_bindings,
|
||||
span,
|
||||
);
|
||||
// Okay to ignore `Err` because of `ErrorReported` (see above).
|
||||
}
|
||||
@ -1189,6 +1190,7 @@ fn add_predicates_for_ast_type_binding(
|
||||
bounds: &mut Bounds<'tcx>,
|
||||
speculative: bool,
|
||||
dup_bindings: &mut FxHashMap<DefId, Span>,
|
||||
path_span: Span,
|
||||
) -> Result<(), ErrorReported> {
|
||||
let tcx = self.tcx();
|
||||
|
||||
@ -1259,7 +1261,7 @@ fn add_predicates_for_ast_type_binding(
|
||||
|| traits::supertraits(tcx, trait_ref),
|
||||
&trait_ref.print_only_trait_path().to_string(),
|
||||
binding.item_name,
|
||||
binding.span,
|
||||
path_span,
|
||||
)
|
||||
}?;
|
||||
|
||||
|
@ -26,7 +26,7 @@ LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar`
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:25:37
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:25:30
|
||||
|
|
||||
LL | type Color;
|
||||
| ----------- ambiguous `Color` from `Vehicle`
|
||||
@ -35,16 +35,16 @@ LL | type Color;
|
||||
| ----------- ambiguous `Color` from `Box`
|
||||
...
|
||||
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
|
||||
| ^^^^^^^^^^^ ambiguous associated type `Color`
|
||||
| ^^^^^^^^^^^^^^^^^^^ ambiguous associated type `Color`
|
||||
|
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn dent_object<COLOR>(c: dyn BoxCar<<BoxCar as Box>::Color>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | fn dent_object<COLOR>(c: dyn <BoxCar as Box>::Color) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn dent_object<COLOR>(c: dyn BoxCar<<BoxCar as Vehicle>::Color>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | fn dent_object<COLOR>(c: dyn <BoxCar as Vehicle>::Color) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0191]: the value of the associated type `Color` (from trait `Vehicle`) must be specified
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:25:30
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0220]: associated type `F` not found for `Trait`
|
||||
--> $DIR/E0220.rs:5:22
|
||||
--> $DIR/E0220.rs:5:16
|
||||
|
|
||||
LL | type Foo = dyn Trait<F=i32>;
|
||||
| ^^^^^ associated type `F` not found
|
||||
| ^^^^^^^^^^^^ associated type `F` not found
|
||||
|
||||
error[E0191]: the value of the associated type `Bar` (from trait `Trait`) must be specified
|
||||
--> $DIR/E0220.rs:5:16
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0220]: associated type `Trget` not found for `std::ops::Deref`
|
||||
--> $DIR/type-binding.rs:6:20
|
||||
--> $DIR/type-binding.rs:6:14
|
||||
|
|
||||
LL | fn homura<T: Deref<Trget = i32>>(_: T) {}
|
||||
| ^^^^^^^^^^^ help: there is an associated type with a similar name: `Target`
|
||||
|
@ -5,10 +5,10 @@ LL | fn f<F:Trait(isize) -> isize>(x: F) {}
|
||||
| ^^^^^^^^^^^^ unexpected type argument
|
||||
|
||||
error[E0220]: associated type `Output` not found for `Trait`
|
||||
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24
|
||||
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8
|
||||
|
|
||||
LL | fn f<F:Trait(isize) -> isize>(x: F) {}
|
||||
| ^^^^^ associated type `Output` not found
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ associated type `Output` not found
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user