Reword and fix test
This commit is contained in:
parent
48fa974211
commit
a5d35631fe
14 changed files with 26 additions and 23 deletions
|
@ -1066,7 +1066,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
let assoc_item = tcx.associated_item(*item_def_id);
|
||||
err.span_label(
|
||||
span,
|
||||
format!("missing associated type `{}` value", assoc_item.ident),
|
||||
format!("associated type `{}` must be specified", assoc_item.ident),
|
||||
);
|
||||
err.span_label(
|
||||
tcx.def_span(*item_def_id),
|
||||
|
@ -1084,8 +1084,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
}
|
||||
}
|
||||
if !suggestions.is_empty() {
|
||||
let msg = if suggestions.len() == 1 {
|
||||
"if you meant to specify the associated type, write"
|
||||
} else {
|
||||
"if you meant to specify the associated types, write"
|
||||
};
|
||||
err.multipart_suggestion_with_applicability(
|
||||
"if you meant to assign the missing associated type, use the name",
|
||||
msg,
|
||||
suggestions,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
|
|
@ -16,9 +16,7 @@ trait Hierarchy {
|
|||
type Value;
|
||||
type ChildKey;
|
||||
type Children = Index<Self::ChildKey, Output=Hierarchy>;
|
||||
//~^ ERROR: the value of the associated type `ChildKey`
|
||||
//~^^ ERROR: the value of the associated type `Children`
|
||||
//~^^^ ERROR: the value of the associated type `Value`
|
||||
//~^ ERROR: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey`
|
||||
|
||||
fn data(&self) -> Option<(Self::Value, Self::Children)>;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ LL | type Color;
|
|||
| ----------- `Color` defined here
|
||||
...
|
||||
LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
|
||||
| ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value
|
||||
| ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `C`
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | type B;
|
|||
| ------- `B` defined here
|
||||
...
|
||||
LL | let b = &42isize as &Foo<A=usize>;
|
||||
| ^^^^^^^^^^^^ missing associated type `B` value
|
||||
| ^^^^^^^^^^^^ associated type `B` must be specified
|
||||
|
||||
error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
|
||||
--> $DIR/associated-types-incomplete-object.rs:36:26
|
||||
|
@ -14,7 +14,7 @@ LL | type A;
|
|||
| ------- `A` defined here
|
||||
...
|
||||
LL | let c = &42isize as &Foo<B=char>;
|
||||
| ^^^^^^^^^^^ missing associated type `A` value
|
||||
| ^^^^^^^^^^^ associated type `A` must be specified
|
||||
|
||||
error[E0191]: the value of the associated types `A` (from the trait `Foo`), `B` (from the trait `Foo`) must be specified
|
||||
--> $DIR/associated-types-incomplete-object.rs:39:26
|
||||
|
@ -27,8 +27,8 @@ LL | type B;
|
|||
LL | let d = &42isize as &Foo;
|
||||
| ^^^
|
||||
| |
|
||||
| missing associated type `A` value
|
||||
| missing associated type `B` value
|
||||
| associated type `A` must be specified
|
||||
| associated type `B` must be specified
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | type Bar;
|
|||
| --------- `Bar` defined here
|
||||
...
|
||||
LL | type Foo = Trait; //~ ERROR E0191
|
||||
| ^^^^^ missing associated type `Bar` value
|
||||
| ^^^^^ associated type `Bar` must be specified
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ LL | type Bar;
|
|||
| --------- `Bar` defined here
|
||||
...
|
||||
LL | type Foo = Trait<F=i32>; //~ ERROR E0220
|
||||
| ^^^^^^^^^^^^ missing associated type `Bar` value
|
||||
| ^^^^^^^^^^^^ associated type `Bar` must be specified
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | type A;
|
|||
| ------- `A` defined here
|
||||
...
|
||||
LL | fn bar(x: &Foo) {}
|
||||
| ^^^ missing associated type `A` value
|
||||
| ^^^ associated type `A` must be specified
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
|||
--> $DIR/issue-21950.rs:17:14
|
||||
|
|
||||
LL | &Add;
|
||||
| ^^^ missing associated type `Output` value
|
||||
| ^^^ associated type `Output` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
|
||||
|
|
||||
|
|
|
@ -5,7 +5,7 @@ LL | type A;
|
|||
| ------- `A` defined here
|
||||
...
|
||||
LL | type I<'a> = &'a (Foo + 'a);
|
||||
| ^^^^^^^^ missing associated type `A` value
|
||||
| ^^^^^^^^ associated type `A` must be specified
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ LL | type Test = Add +
|
|||
LL | | //~^ ERROR E0393
|
||||
LL | | //~| ERROR E0191
|
||||
LL | | Sub;
|
||||
| |_______________^ missing associated type `Output` value
|
||||
| |_______________^ associated type `Output` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
|
||||
|
|
||||
|
|
|
@ -16,7 +16,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
|||
--> $DIR/issue-23024.rs:19:35
|
||||
|
|
||||
LL | println!("{:?}",(vfnfer[0] as Fn)(3));
|
||||
| ^^ missing associated type `Output` value
|
||||
| ^^ associated type `Output` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/function.rs:LL:COL
|
||||
|
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
|||
--> $DIR/issue-28344.rs:14:17
|
||||
|
|
||||
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
|
||||
| ^^^^^^^^^^^^^ missing associated type `Output` value
|
||||
| ^^^^^^^^^^^^^ associated type `Output` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
|
||||
|
|
||||
|
@ -21,7 +21,7 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
|||
--> $DIR/issue-28344.rs:18:13
|
||||
|
|
||||
LL | let g = BitXor::bitor;
|
||||
| ^^^^^^^^^^^^^ missing associated type `Output` value
|
||||
| ^^^^^^^^^^^^^ associated type `Output` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
|
||||
|
|
||||
|
|
|
@ -18,9 +18,9 @@ LL | }
|
|||
LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| missing associated type `A` value
|
||||
| missing associated type `C` value
|
||||
help: if you meant to assign the missing associated type, use the name
|
||||
| associated type `A` must be specified
|
||||
| associated type `C` must be specified
|
||||
help: if you meant to specify the associated types, write
|
||||
|
|
||||
LL | pub struct Foo { i: Box<T<usize, usize, A = usize, C = usize, B=usize>> }
|
||||
| ^^^^^^^^^ ^^^^^^^^^
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Item` (from the trait `std::iter
|
|||
--> $DIR/trait-alias-object.rs:18:13
|
||||
|
|
||||
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
|
||||
| ^^^^^^^^^^^^^^^^^ missing associated type `Item` value
|
||||
| ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified
|
||||
|
|
||||
::: $SRC_DIR/libcore/iter/iterator.rs:LL:COL
|
||||
|
|
||||
|
|
Loading…
Reference in a new issue