diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-02 07:24:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-02 07:24:02 +0100 |
| commit | 832987bb1e0691b44a057414d57d23c64e6c7d97 (patch) | |
| tree | 4f9c4171f898fef26d7e734d12db995a10ca498a /src/tools | |
| parent | c09a9a69e2f1f81ed1153e6d0993a9ec9939b8e3 (diff) | |
| parent | 6c2a952b5637f4795ad1d3ed08dfa4f43eaece51 (diff) | |
Rollup merge of #108609 - clubby789:e0599-highlight, r=estebank
Highlight whole expression for E0599 Fixes #108603 This adds a secondary label to highlight the whole expression leading to the error. It also prevents empty labels being recognised as 'unexpected' by compiletest - otherwise, tests with NOTE annotations would pick up empty labels. `@rustbot` label +A-diagnostics
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 7824ef81d7a..41c23ff86b2 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1432,12 +1432,13 @@ impl<'test> TestCx<'test> { expect_help: bool, expect_note: bool, ) -> bool { - match actual_error.kind { - Some(ErrorKind::Help) => expect_help, - Some(ErrorKind::Note) => expect_note, - Some(ErrorKind::Error) | Some(ErrorKind::Warning) => true, - Some(ErrorKind::Suggestion) | None => false, - } + !actual_error.msg.is_empty() + && match actual_error.kind { + Some(ErrorKind::Help) => expect_help, + Some(ErrorKind::Note) => expect_note, + Some(ErrorKind::Error) | Some(ErrorKind::Warning) => true, + Some(ErrorKind::Suggestion) | None => false, + } } fn should_emit_metadata(&self, pm: Option<PassMode>) -> Emit { |
