Skip to content

Commit a5d3563

Browse files
committed
Reword and fix test
1 parent 48fa974 commit a5d3563

14 files changed

+26
-23
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
10661066
let assoc_item = tcx.associated_item(*item_def_id);
10671067
err.span_label(
10681068
span,
1069-
format!("missing associated type `{}` value", assoc_item.ident),
1069+
format!("associated type `{}` must be specified", assoc_item.ident),
10701070
);
10711071
err.span_label(
10721072
tcx.def_span(*item_def_id),
@@ -1084,8 +1084,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
10841084
}
10851085
}
10861086
if !suggestions.is_empty() {
1087+
let msg = if suggestions.len() == 1 {
1088+
"if you meant to specify the associated type, write"
1089+
} else {
1090+
"if you meant to specify the associated types, write"
1091+
};
10871092
err.multipart_suggestion_with_applicability(
1088-
"if you meant to assign the missing associated type, use the name",
1093+
msg,
10891094
suggestions,
10901095
Applicability::MaybeIncorrect,
10911096
);

src/test/compile-fail/issue-23595-1.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ trait Hierarchy {
1616
type Value;
1717
type ChildKey;
1818
type Children = Index<Self::ChildKey, Output=Hierarchy>;
19-
//~^ ERROR: the value of the associated type `ChildKey`
20-
//~^^ ERROR: the value of the associated type `Children`
21-
//~^^^ ERROR: the value of the associated type `Value`
19+
//~^ ERROR: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey`
2220

2321
fn data(&self) -> Option<(Self::Value, Self::Children)>;
2422
}

src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ LL | type Color;
2929
| ----------- `Color` defined here
3030
...
3131
LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
32-
| ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value
32+
| ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified
3333

3434
error[E0221]: ambiguous associated type `Color` in bounds of `C`
3535
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29

src/test/ui/associated-types/associated-types-incomplete-object.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type B;
55
| ------- `B` defined here
66
...
77
LL | let b = &42isize as &Foo<A=usize>;
8-
| ^^^^^^^^^^^^ missing associated type `B` value
8+
| ^^^^^^^^^^^^ associated type `B` must be specified
99

1010
error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
1111
--> $DIR/associated-types-incomplete-object.rs:36:26
@@ -14,7 +14,7 @@ LL | type A;
1414
| ------- `A` defined here
1515
...
1616
LL | let c = &42isize as &Foo<B=char>;
17-
| ^^^^^^^^^^^ missing associated type `A` value
17+
| ^^^^^^^^^^^ associated type `A` must be specified
1818

1919
error[E0191]: the value of the associated types `A` (from the trait `Foo`), `B` (from the trait `Foo`) must be specified
2020
--> $DIR/associated-types-incomplete-object.rs:39:26
@@ -27,8 +27,8 @@ LL | type B;
2727
LL | let d = &42isize as &Foo;
2828
| ^^^
2929
| |
30-
| missing associated type `A` value
31-
| missing associated type `B` value
30+
| associated type `A` must be specified
31+
| associated type `B` must be specified
3232

3333
error: aborting due to 3 previous errors
3434

src/test/ui/error-codes/E0191.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Bar;
55
| --------- `Bar` defined here
66
...
77
LL | type Foo = Trait; //~ ERROR E0191
8-
| ^^^^^ missing associated type `Bar` value
8+
| ^^^^^ associated type `Bar` must be specified
99

1010
error: aborting due to previous error
1111

src/test/ui/error-codes/E0220.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | type Bar;
1111
| --------- `Bar` defined here
1212
...
1313
LL | type Foo = Trait<F=i32>; //~ ERROR E0220
14-
| ^^^^^^^^^^^^ missing associated type `Bar` value
14+
| ^^^^^^^^^^^^ associated type `Bar` must be specified
1515

1616
error: aborting due to 2 previous errors
1717

src/test/ui/issues/issue-19482.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type A;
55
| ------- `A` defined here
66
...
77
LL | fn bar(x: &Foo) {}
8-
| ^^^ missing associated type `A` value
8+
| ^^^ associated type `A` must be specified
99

1010
error: aborting due to previous error
1111

src/test/ui/issues/issue-21950.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
1010
--> $DIR/issue-21950.rs:17:14
1111
|
1212
LL | &Add;
13-
| ^^^ missing associated type `Output` value
13+
| ^^^ associated type `Output` must be specified
1414
|
1515
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
1616
|

src/test/ui/issues/issue-22434.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type A;
55
| ------- `A` defined here
66
...
77
LL | type I<'a> = &'a (Foo + 'a);
8-
| ^^^^^^^^ missing associated type `A` value
8+
| ^^^^^^^^ associated type `A` must be specified
99

1010
error: aborting due to previous error
1111

src/test/ui/issues/issue-22560.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ LL | type Test = Add +
2828
LL | | //~^ ERROR E0393
2929
LL | | //~| ERROR E0191
3030
LL | | Sub;
31-
| |_______________^ missing associated type `Output` value
31+
| |_______________^ associated type `Output` must be specified
3232
|
3333
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
3434
|

0 commit comments

Comments
 (0)