From b79e15d32c4cd14b4428d1b05a16a7d2234490cc Mon Sep 17 00:00:00 2001 From: "Panashe M. Fundira" Date: Fri, 5 Aug 2016 17:20:47 -0400 Subject: [PATCH] Update E0191 to the new error format --- src/librustc_typeck/astconv.rs | 7 +++++-- src/test/compile-fail/E0191.rs | 1 + ...associated-type-projection-from-multiple-supertraits.rs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 3b2bca4ab3912..388f2fb53e651 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1194,10 +1194,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { } for (trait_def_id, name) in associated_types { - span_err!(tcx.sess, span, E0191, + struct_span_err!(tcx.sess, span, E0191, "the value of the associated type `{}` (from the trait `{}`) must be specified", name, - tcx.item_path_str(trait_def_id)); + tcx.item_path_str(trait_def_id)) + .span_label(span, &format!( + "missing associated type `{}` value", name)) + .emit(); } tcx.mk_trait(object.principal, object.bounds) diff --git a/src/test/compile-fail/E0191.rs b/src/test/compile-fail/E0191.rs index 489ebb033f84e..dcfe441ab0d00 100644 --- a/src/test/compile-fail/E0191.rs +++ b/src/test/compile-fail/E0191.rs @@ -13,6 +13,7 @@ trait Trait { } type Foo = Trait; //~ ERROR E0191 + //~| NOTE missing associated type `Bar` value fn main() { } diff --git a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs b/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs index 2b34fcab24c04..007f1d3a2947d 100644 --- a/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/compile-fail/associated-type-projection-from-multiple-supertraits.rs @@ -37,6 +37,7 @@ fn dent_object(c: BoxCar) { //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified //~| NOTE could derive from `Vehicle` //~| NOTE could derive from `Box` + //~| NOTE missing associated type `Color` value } fn paint(c: C, d: C::Color) {