Skip to content

Commit 1d25e2e

Browse files
committed
Update compiler error 0029 to use new error format.
1 parent b30eff7 commit 1d25e2e

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/librustc_typeck/check/_match.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
9393
end.span
9494
};
9595

96-
// Note: spacing here is intentional, we want a space before "start" and "end".
97-
span_err!(tcx.sess, span, E0029,
98-
"only char and numeric types are allowed in range patterns\n \
99-
start type: {}\n end type: {}",
100-
self.ty_to_string(lhs_ty),
101-
self.ty_to_string(rhs_ty)
102-
);
96+
struct_span_err!(tcx.sess, span, E0029,
97+
"only char and numeric types are allowed in range patterns")
98+
.span_label(span, &format!("ranges require char or numeric types"))
99+
.note(&format!("start type: {}", self.ty_to_string(lhs_ty)))
100+
.note(&format!("end type: {}", self.ty_to_string(rhs_ty)))
101+
.emit();
103102
return;
104103
}
105104

src/test/compile-fail/E0029.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ fn main() {
1212
let s = "hoho";
1313

1414
match s {
15-
"hello" ... "world" => {} //~ ERROR E0029
15+
"hello" ... "world" => {}
16+
//~^ ERROR only char and numeric types are allowed in range patterns
17+
//~| NOTE ranges require char or numeric types
18+
//~| NOTE start type: &'static str
19+
//~| NOTE end type: &'static str
1620
_ => {}
1721
}
1822
}

0 commit comments

Comments
 (0)