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

+7-2
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

+1-3
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

+1-1
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

+4-4
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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

+1-1
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
|

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
1616
--> $DIR/issue-23024.rs:19:35
1717
|
1818
LL | println!("{:?}",(vfnfer[0] as Fn)(3));
19-
| ^^ missing associated type `Output` value
19+
| ^^ associated type `Output` must be specified
2020
|
2121
::: $SRC_DIR/libcore/ops/function.rs:LL:COL
2222
|

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
22
--> $DIR/issue-28344.rs:14:17
33
|
44
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
5-
| ^^^^^^^^^^^^^ missing associated type `Output` value
5+
| ^^^^^^^^^^^^^ associated type `Output` must be specified
66
|
77
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
88
|
@@ -21,7 +21,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
2121
--> $DIR/issue-28344.rs:18:13
2222
|
2323
LL | let g = BitXor::bitor;
24-
| ^^^^^^^^^^^^^ missing associated type `Output` value
24+
| ^^^^^^^^^^^^^ associated type `Output` must be specified
2525
|
2626
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
2727
|

src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ LL | }
1818
LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> }
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020
| |
21-
| missing associated type `A` value
22-
| missing associated type `C` value
23-
help: if you meant to assign the missing associated type, use the name
21+
| associated type `A` must be specified
22+
| associated type `C` must be specified
23+
help: if you meant to specify the associated types, write
2424
|
2525
LL | pub struct Foo { i: Box<T<usize, usize, A = usize, C = usize, B=usize>> }
2626
| ^^^^^^^^^ ^^^^^^^^^

src/test/ui/traits/trait-alias-object.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Item` (from the trait `std::iter
1010
--> $DIR/trait-alias-object.rs:18:13
1111
|
1212
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
13-
| ^^^^^^^^^^^^^^^^^ missing associated type `Item` value
13+
| ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified
1414
|
1515
::: $SRC_DIR/libcore/iter/iterator.rs:LL:COL
1616
|

0 commit comments

Comments
 (0)