Rollup merge of #35555 - circuitfox:E0128-update-error-format, r=jonathandturner

E0128 update error format

Fixes #35508

Part of #35233

r? @jonathandturner
This commit is contained in:
Jonathan Turner 2016-08-11 06:34:00 -07:00 committed by GitHub
commit a5408a5415
3 changed files with 8 additions and 3 deletions

View File

@ -1903,9 +1903,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
}

View 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,
}

View 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() {}