From 766a0ab651e3467ab34f3e78e7a343d51c9f4706 Mon Sep 17 00:00:00 2001 From: Chris Stankus Date: Tue, 9 Aug 2016 15:12:46 -0500 Subject: [PATCH] E0128 update error format --- src/librustc_typeck/collect.rs | 9 ++++++--- src/test/compile-fail/E0128.rs | 1 + src/test/compile-fail/issue-18183.rs | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 9b1a6c78335f1..ca1f1a21a2ee3 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1901,9 +1901,12 @@ fn convert_default_type_parameter<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, for leaf_ty in ty.walk() { if let ty::TyParam(p) = leaf_ty.sty { if p.space == space && p.idx >= index { - span_err!(ccx.tcx.sess, path.span, E0128, - "type parameters with a default cannot use \ - forward declared identifiers"); + struct_span_err!(ccx.tcx.sess, path.span, E0128, + "type parameters with a default cannot use \ + forward declared identifiers") + .span_label(path.span, &format!("defaulted type parameters \ + cannot be forward declared")) + .emit(); return ccx.tcx.types.err } diff --git a/src/test/compile-fail/E0128.rs b/src/test/compile-fail/E0128.rs index 37071012825ec..f5829b9385941 100644 --- a/src/test/compile-fail/E0128.rs +++ b/src/test/compile-fail/E0128.rs @@ -9,6 +9,7 @@ // except according to those terms. struct Foo { //~ ERROR E0128 + //~| NOTE defaulted type parameters cannot be forward declared field1: T, field2: U, } diff --git a/src/test/compile-fail/issue-18183.rs b/src/test/compile-fail/issue-18183.rs index e6f3a2bdd33ad..b3fc3aea148ee 100644 --- a/src/test/compile-fail/issue-18183.rs +++ b/src/test/compile-fail/issue-18183.rs @@ -9,5 +9,6 @@ // except according to those terms. pub struct Foo; //~ ERROR E0128 + //~| NOTE defaulted type parameters cannot be forward declared pub struct Baz(Foo); fn main() {}