Skip to content

Commit a5408a5

Browse files
author
Jonathan Turner
authored
Rollup merge of #35555 - circuitfox:E0128-update-error-format, r=jonathandturner
E0128 update error format Fixes #35508 Part of #35233 r? @jonathandturner
2 parents b76ca89 + 766a0ab commit a5408a5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/librustc_typeck/collect.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,9 +1903,12 @@ fn convert_default_type_parameter<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
19031903
for leaf_ty in ty.walk() {
19041904
if let ty::TyParam(p) = leaf_ty.sty {
19051905
if p.space == space && p.idx >= index {
1906-
span_err!(ccx.tcx.sess, path.span, E0128,
1907-
"type parameters with a default cannot use \
1908-
forward declared identifiers");
1906+
struct_span_err!(ccx.tcx.sess, path.span, E0128,
1907+
"type parameters with a default cannot use \
1908+
forward declared identifiers")
1909+
.span_label(path.span, &format!("defaulted type parameters \
1910+
cannot be forward declared"))
1911+
.emit();
19091912

19101913
return ccx.tcx.types.err
19111914
}

src/test/compile-fail/E0128.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
struct Foo<T=U, U=()> { //~ ERROR E0128
12+
//~| NOTE defaulted type parameters cannot be forward declared
1213
field1: T,
1314
field2: U,
1415
}

src/test/compile-fail/issue-18183.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@
99
// except according to those terms.
1010

1111
pub struct Foo<Bar=Bar>; //~ ERROR E0128
12+
//~| NOTE defaulted type parameters cannot be forward declared
1213
pub struct Baz(Foo);
1314
fn main() {}

0 commit comments

Comments
 (0)