]> git.lizzy.rs Git - rust.git/commitdiff
E0128 update error format
authorChris Stankus <cdstankus@gmail.com>
Tue, 9 Aug 2016 20:12:46 +0000 (15:12 -0500)
committerChris Stankus <cdstankus@gmail.com>
Tue, 9 Aug 2016 20:13:32 +0000 (15:13 -0500)
src/librustc_typeck/collect.rs
src/test/compile-fail/E0128.rs
src/test/compile-fail/issue-18183.rs

index 9b1a6c78335f189470f69c1d31b59706e37c21b3..ca1f1a21a2ee32a3101cd954f669cd77fe495ea0 100644 (file)
@@ -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
             }
index 37071012825ec9b67f9984e7f202300f80eee315..f5829b93859412c007daad508a71767652eb9140 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 struct Foo<T=U, U=()> { //~ ERROR E0128
+                        //~| NOTE defaulted type parameters cannot be forward declared
     field1: T,
     field2: U,
 }
index e6f3a2bdd33ad127a14960d350de8bba749b62af..b3fc3aea148ee3b6cdaf70e4e75a4af0c862a78b 100644 (file)
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 pub struct Foo<Bar=Bar>; //~ ERROR E0128
+                         //~| NOTE defaulted type parameters cannot be forward declared
 pub struct Baz(Foo);
 fn main() {}