diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-08-30 10:39:08 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-30 10:39:08 +0200 |
| commit | 1d2308f2ed2c8708f78c5253661ec957f29b503b (patch) | |
| tree | 9ecd55fffbd5b11c5ff58010e74b98c1bc5c8ec4 | |
| parent | 9a3cfe91291c78c8c1e3fc75e274693b523dece6 (diff) | |
| parent | 2967dcc4d7bf0722fb348092a254aaa12deaa6d8 (diff) | |
| download | rust-1d2308f2ed2c8708f78c5253661ec957f29b503b.tar.gz rust-1d2308f2ed2c8708f78c5253661ec957f29b503b.zip | |
Rollup merge of #36125 - gavinb:error_msgs_p1, r=jonathandturner
Update Error format for E0164, E0165, E0184 Part of #35233 r? @jonathandturner
| -rw-r--r-- | src/librustc_const_eval/check_match.rs | 5 | ||||
| -rw-r--r-- | src/librustc_typeck/check/_match.rs | 3 | ||||
| -rw-r--r-- | src/librustc_typeck/coherence/mod.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/E0164.rs | 1 | ||||
| -rw-r--r-- | src/test/compile-fail/E0165.rs | 1 | ||||
| -rw-r--r-- | src/test/compile-fail/E0184.rs | 2 |
6 files changed, 14 insertions, 4 deletions
diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 82c142c919e..e71a780dd89 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -324,7 +324,10 @@ fn check_arms(cx: &MatchCheckCtxt, let &(ref first_arm_pats, _) = &arms[0]; let first_pat = &first_arm_pats[0]; let span = first_pat.span; - span_err!(cx.tcx.sess, span, E0165, "irrefutable while-let pattern"); + struct_span_err!(cx.tcx.sess, span, E0165, + "irrefutable while-let pattern") + .span_label(span, &format!("irrefutable pattern")) + .emit(); }, hir::MatchSource::ForLoopDesugar => { diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 78175c85b19..225468cb9f4 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -574,7 +574,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.sess.add_lint(lint::builtin::MATCH_OF_UNIT_VARIANT_VIA_PAREN_DOTDOT, pat.id, pat.span, msg); } else { - span_err!(tcx.sess, pat.span, E0164, "{}", msg); + struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg) + .span_label(pat.span, &format!("not a tuple variant or struct")).emit(); on_error(); } }; diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 7d6cee7b3ba..f743ef21875 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -348,9 +348,11 @@ impl<'a, 'gcx, 'tcx> CoherenceChecker<'a, 'gcx, 'tcx> { .emit(); } Err(CopyImplementationError::HasDestructor) => { - span_err!(tcx.sess, span, E0184, + struct_span_err!(tcx.sess, span, E0184, "the trait `Copy` may not be implemented for this type; \ - the type has a destructor"); + the type has a destructor") + .span_label(span, &format!("Copy not allowed on types with destructors")) + .emit(); } } }); diff --git a/src/test/compile-fail/E0164.rs b/src/test/compile-fail/E0164.rs index 491b2e9e5b2..1665a80bead 100644 --- a/src/test/compile-fail/E0164.rs +++ b/src/test/compile-fail/E0164.rs @@ -13,6 +13,7 @@ enum Foo { B { i: u32 } } fn bar(foo: Foo) -> u32 { match foo { Foo::B(i) => i, //~ ERROR E0164 + //~| NOTE not a tuple variant or struct } } diff --git a/src/test/compile-fail/E0165.rs b/src/test/compile-fail/E0165.rs index cca714bbcc1..142635fc6ee 100644 --- a/src/test/compile-fail/E0165.rs +++ b/src/test/compile-fail/E0165.rs @@ -13,6 +13,7 @@ struct Irrefutable(i32); fn main() { let irr = Irrefutable(0); while let Irrefutable(x) = irr { //~ ERROR E0165 + //~| irrefutable pattern // ... } } diff --git a/src/test/compile-fail/E0184.rs b/src/test/compile-fail/E0184.rs index 5d72d00ffe8..9ec2eeba5cc 100644 --- a/src/test/compile-fail/E0184.rs +++ b/src/test/compile-fail/E0184.rs @@ -9,6 +9,8 @@ // except according to those terms. #[derive(Copy)] //~ ERROR E0184 + //~| NOTE Copy not allowed on types with destructors + //~| NOTE in this expansion of #[derive(Copy)] struct Foo; impl Drop for Foo { |
