Skip to content

Commit

Permalink
Rollup merge of rust-lang#35555 - circuitfox:E0128-update-error-forma…
Browse files Browse the repository at this point in the history
…t, r=jonathandturner

E0128 update error format

Fixes rust-lang#35508

Part of rust-lang#35233

r? @jonathandturner
  • Loading branch information
steveklabnik committed Aug 10, 2016
2 parents 928d105 + 766a0ab commit 5506990
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/E0128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-18183.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

0 comments on commit 5506990

Please sign in to comment.