Skip to content

Commit 7580ef9

Browse files
committed
auto merge of #14743 : Sawyer47/rust/range-msg, r=huonw
Range allows char and numeric types, but previous error message mentioned only numeric types.
2 parents bbd448a + 90339ef commit 7580ef9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/librustc/middle/typeck/check/_match.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,8 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
460460
{
461461
// no-op
462462
} else if !ty::type_is_numeric(b_ty) && !ty::type_is_char(b_ty) {
463-
tcx.sess.span_err(pat.span, "non-numeric type used in range");
463+
tcx.sess.span_err(pat.span,
464+
"only char and numeric types are allowed in range");
464465
} else {
465466
match valid_range_bounds(fcx.ccx, begin, end) {
466467
Some(false) => {

src/test/compile-fail/match-range-fail.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
//error-pattern: lower range bound
12-
//error-pattern: non-numeric
12+
//error-pattern: only char and numeric types
1313
//error-pattern: mismatched types
1414

1515
fn main() {

0 commit comments

Comments
 (0)