Point at the associated type's def span

This commit is contained in:
Esteban Küber 2018-11-08 18:14:41 -08:00
parent 286f7ae1dd
commit b6f4b29c6d
13 changed files with 66 additions and 0 deletions

View File

@ -1053,6 +1053,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
span,
format!("missing associated type `{}` value", assoc_item.ident),
);
err.span_label(
tcx.def_span(item_def_id),
format!("`{}` defined here", assoc_item.ident),
);
}
err.emit();
}

View File

@ -25,6 +25,9 @@ LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26
|
LL | type Color;
| ----------- `Color` defined here
...
LL | fn dent_object<COLOR>(c: BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value

View File

@ -1,18 +1,29 @@
error[E0191]: the value of the associated type `B` (from the trait `Foo`) must be specified
--> $DIR/associated-types-incomplete-object.rs:33:26
|
LL | type B;
| ------- `B` defined here
...
LL | let b = &42isize as &Foo<A=usize>;
| ^^^^^^^^^^^^ missing associated type `B` value
error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
--> $DIR/associated-types-incomplete-object.rs:36:26
|
LL | type A;
| ------- `A` defined here
...
LL | let c = &42isize as &Foo<B=char>;
| ^^^^^^^^^^^ missing associated type `A` value
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
|
LL | type A;
| ------- `A` defined here
LL | type B;
| ------- `B` defined here
...
LL | let d = &42isize as &Foo;
| ^^^
| |

View File

@ -9,6 +9,12 @@ LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> }
error[E0191]: the value of the associated types `A` (from the trait `T`), `C` (from the trait `T`) must be specified
--> $DIR/E0107-b.rs:6:26
|
LL | type A;
| ------- `A` defined here
LL | type B;
LL | type C;
| ------- `C` defined here
LL | }
LL | pub struct Foo { i: Box<T<usize, usize, usize, usize, B=usize>> }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |

View File

@ -1,6 +1,9 @@
error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified
--> $DIR/E0191.rs:15:12
|
LL | type Bar;
| --------- `Bar` defined here
...
LL | type Foo = Trait; //~ ERROR E0191
| ^^^^^ missing associated type `Bar` value

View File

@ -7,6 +7,9 @@ LL | type Foo = Trait<F=i32>; //~ ERROR E0220
error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified
--> $DIR/E0220.rs:15:12
|
LL | type Bar;
| --------- `Bar` defined here
...
LL | type Foo = Trait<F=i32>; //~ ERROR E0220
| ^^^^^^^^^^^^ missing associated type `Bar` value

View File

@ -1,6 +1,9 @@
error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
--> $DIR/issue-19482.rs:20:12
|
LL | type A;
| ------- `A` defined here
...
LL | fn bar(x: &Foo) {}
| ^^^ missing associated type `A` value

View File

@ -11,6 +11,11 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
LL | &Add;
| ^^^ missing associated type `Output` value
|
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
|
LL | type Output;
| ------------ `Output` defined here
error: aborting due to 2 previous errors

View File

@ -1,6 +1,9 @@
error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
--> $DIR/issue-22434.rs:15:19
|
LL | type A;
| ------- `A` defined here
...
LL | type I<'a> = &'a (Foo + 'a);
| ^^^^^^^^ missing associated type `A` value

View File

@ -29,6 +29,11 @@ LL | | //~^ ERROR E0393
LL | | //~| ERROR E0191
LL | | Sub;
| |_______________^ missing associated type `Output` value
|
::: $SRC_DIR/libcore/ops/arith.rs:LL:COL
|
LL | type Output;
| ------------ `Output` defined here
error: aborting due to 4 previous errors

View File

@ -17,6 +17,11 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
LL | println!("{:?}",(vfnfer[0] as Fn)(3));
| ^^ missing associated type `Output` value
|
::: $SRC_DIR/libcore/ops/function.rs:LL:COL
|
LL | type Output;
| ------------ `Output` defined here
error: aborting due to 3 previous errors

View File

@ -3,6 +3,11 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
| ^^^^^^^^^^^^^ missing associated type `Output` value
|
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
|
LL | type Output;
| ------------ `Output` defined here
error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
--> $DIR/issue-28344.rs:14:17
@ -17,6 +22,11 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op
|
LL | let g = BitXor::bitor;
| ^^^^^^^^^^^^^ missing associated type `Output` value
|
::: $SRC_DIR/libcore/ops/bit.rs:LL:COL
|
LL | type Output;
| ------------ `Output` defined here
error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
--> $DIR/issue-28344.rs:18:13

View File

@ -11,6 +11,11 @@ error[E0191]: the value of the associated type `Item` (from the trait `std::iter
|
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
| ^^^^^^^^^^^^^^^^^ missing associated type `Item` value
|
::: $SRC_DIR/libcore/iter/iterator.rs:LL:COL
|
LL | type Item;
| ---------- `Item` defined here
error: aborting due to 2 previous errors