Skip to content

Commit

Permalink
Rollup merge of rust-lang#35413 - silenuss:e0029-formatting, r=jonath…
Browse files Browse the repository at this point in the history
…andturner

Update compiler error 0029 to use new error format.

Part of rust-lang#35233,
Addresses rust-lang#35201

r? @jonathandturner
  • Loading branch information
Jonathan Turner committed Aug 7, 2016
2 parents 7e37442 + 1d25e2e commit 0297196
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 5 additions & 1 deletion src/test/compile-fail/E0029.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
_ => {}
}
}

0 comments on commit 0297196

Please sign in to comment.