diff options
| author | silenuss <mattschieving@gmail.com> | 2016-08-06 00:33:59 -0600 |
|---|---|---|
| committer | silenuss <mattschieving@gmail.com> | 2016-08-06 01:29:36 -0600 |
| commit | 1d25e2eeccc40cbde2a1ed5be043889c1450cd93 (patch) | |
| tree | f67d2a8c4f25a34f89d1749be8c1eda67fc31feb /src | |
| parent | b30eff7ba72a78e31acd61a2b6931919a0ad62e8 (diff) | |
| download | rust-1d25e2eeccc40cbde2a1ed5be043889c1450cd93.tar.gz rust-1d25e2eeccc40cbde2a1ed5be043889c1450cd93.zip | |
Update compiler error 0029 to use new error format.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/check/_match.rs | 13 | ||||
| -rw-r--r-- | src/test/compile-fail/E0029.rs | 6 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index aae6e3ad36d..82a100f1899 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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; } diff --git a/src/test/compile-fail/E0029.rs b/src/test/compile-fail/E0029.rs index 9cbdec99520..ec84e2a3f8a 100644 --- a/src/test/compile-fail/E0029.rs +++ b/src/test/compile-fail/E0029.rs @@ -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 _ => {} } } |
