Rollup merge of #35413 - silenuss:e0029-formatting, r=jonathandturner

Update compiler error 0029 to use new error format.

Part of #35233,
Addresses #35201

r? @jonathandturner
This commit is contained in:
Jonathan Turner 2016-08-07 09:59:42 -07:00 committed by GitHub
commit 02971961c7
2 changed files with 11 additions and 8 deletions

View File

@ -93,13 +93,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
end.span
};
// Note: spacing here is intentional, we want a space before "start" and "end".
span_err!(tcx.sess, span, E0029,
"only char and numeric types are allowed in range patterns\n \
start type: {}\n end type: {}",
self.ty_to_string(lhs_ty),
self.ty_to_string(rhs_ty)
);
struct_span_err!(tcx.sess, span, E0029,
"only char and numeric types are allowed in range patterns")
.span_label(span, &format!("ranges require char or numeric types"))
.note(&format!("start type: {}", self.ty_to_string(lhs_ty)))
.note(&format!("end type: {}", self.ty_to_string(rhs_ty)))
.emit();
return;
}

View File

@ -12,7 +12,11 @@ fn main() {
let s = "hoho";
match s {
"hello" ... "world" => {} //~ ERROR E0029
"hello" ... "world" => {}
//~^ ERROR only char and numeric types are allowed in range patterns
//~| NOTE ranges require char or numeric types
//~| NOTE start type: &'static str
//~| NOTE end type: &'static str
_ => {}
}
}