compiletest: Support matching on non-json lines in compiler output

and migrate most of remaining `error-pattern`s to it.
This commit is contained in:
Vadim Petrochenkov 2025-05-02 17:56:07 +03:00
parent 62c5f58f57
commit 56d6b4e427
63 changed files with 208 additions and 196 deletions

View file

@ -344,8 +344,7 @@ For checking runtime output, `//@ check-run-results` may be preferable.
Only use `error-pattern` if none of the above works.
Line annotations `//~` are still checked in tests using `error-pattern`.
In exceptional cases, use `//@ compile-flags: --error-format=human` to opt out of these checks.
Line annotations `//~` and `error-pattern` are compatible and can be used in the same test.
### Diagnostic kinds (error levels)
@ -356,9 +355,12 @@ The diagnostic kinds that you can have are:
- `NOTE`
- `HELP`
- `SUGGESTION`
- `RAW`
The `SUGGESTION` kind is used for specifying what the expected replacement text
should be for a diagnostic suggestion.
The `RAW` kind can be used for matching on lines from non-structured output sometimes emitted
by the compiler instead of or in addition to structured json.
`ERROR` and `WARN` kinds are required to be exhaustively covered by line annotations
`//~` by default.

View file

@ -15,6 +15,7 @@ pub enum ErrorKind {
Note,
Suggestion,
Warning,
Raw,
}
impl ErrorKind {
@ -39,6 +40,7 @@ impl ErrorKind {
"NOTE" | "note" | "MONO_ITEM" => ErrorKind::Note,
"SUGGESTION" => ErrorKind::Suggestion,
"WARN" | "WARNING" | "warn" | "warning" => ErrorKind::Warning,
"RAW" => ErrorKind::Raw,
_ => panic!(
"unexpected diagnostic kind `{s}`, expected \
`ERROR`, `WARN`, `NOTE`, `HELP` or `SUGGESTION`"
@ -55,6 +57,7 @@ impl fmt::Display for ErrorKind {
ErrorKind::Note => write!(f, "NOTE"),
ErrorKind::Suggestion => write!(f, "SUGGESTION"),
ErrorKind::Warning => write!(f, "WARN"),
ErrorKind::Raw => write!(f, "RAW"),
}
}
}

View file

@ -7,7 +7,6 @@ use regex::Regex;
use serde::Deserialize;
use crate::errors::{Error, ErrorKind};
use crate::runtest::ProcRes;
#[derive(Deserialize)]
struct Diagnostic {
@ -140,28 +139,19 @@ pub fn extract_rendered(output: &str) -> String {
.collect()
}
pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec<Error> {
pub fn parse_output(file_name: &str, output: &str) -> Vec<Error> {
let mut errors = Vec::new();
for line in output.lines() {
// The compiler sometimes intermingles non-JSON stuff into the
// output. This hack just skips over such lines. Yuck.
if line.starts_with('{') {
match serde_json::from_str::<Diagnostic>(line) {
Ok(diagnostic) => push_actual_errors(&mut errors, &diagnostic, &[], file_name),
Err(error) => {
// Ignore the future compat report message - this is handled
// by `extract_rendered`
if serde_json::from_str::<FutureIncompatReport>(line).is_err() {
proc_res.fatal(
Some(&format!(
"failed to decode compiler output as json: `{}`\nline: {}\noutput: {}",
error, line, output
)),
|| (),
);
}
}
}
// Compiler can emit non-json lines in non-`--error-format=json` modes,
// and in some situations even in json mode.
match serde_json::from_str::<Diagnostic>(line) {
Ok(diagnostic) => push_actual_errors(&mut errors, &diagnostic, &[], file_name),
Err(_) => errors.push(Error {
line_num: None,
kind: ErrorKind::Raw,
msg: line.to_string(),
require_annotation: false,
}),
}
}
errors

View file

@ -23,7 +23,7 @@ use crate::common::{
output_base_dir, output_base_name, output_testname_unique,
};
use crate::compute_diff::{DiffLine, make_diff, write_diff, write_filtered_diff};
use crate::errors::{Error, ErrorKind};
use crate::errors::{Error, ErrorKind, load_errors};
use crate::header::TestProps;
use crate::read2::{Truncated, read2_abbreviated};
use crate::util::{Utf8PathBufExt, add_dylib_path, logv, static_regex};
@ -577,23 +577,9 @@ impl<'test> TestCx<'test> {
}
}
fn check_all_error_patterns(
&self,
output_to_check: &str,
proc_res: &ProcRes,
pm: Option<PassMode>,
) {
if self.props.error_patterns.is_empty() && self.props.regex_error_patterns.is_empty() {
if pm.is_some() {
// FIXME(#65865)
return;
} else {
self.fatal(&format!("no error pattern specified in {}", self.testpaths.file));
}
}
/// Check `error-pattern` and `regex-error-pattern` directives.
fn check_all_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) {
let mut missing_patterns: Vec<String> = Vec::new();
self.check_error_patterns(output_to_check, &mut missing_patterns);
self.check_regex_error_patterns(output_to_check, proc_res, &mut missing_patterns);
@ -670,7 +656,9 @@ impl<'test> TestCx<'test> {
}
}
fn check_expected_errors(&self, expected_errors: Vec<Error>, proc_res: &ProcRes) {
/// Check `//~ KIND message` annotations.
fn check_expected_errors(&self, proc_res: &ProcRes) {
let expected_errors = load_errors(&self.testpaths.file, self.revision);
debug!(
"check_expected_errors: expected_errors={:?} proc_res.status={:?}",
expected_errors, proc_res.status
@ -711,11 +699,24 @@ impl<'test> TestCx<'test> {
.collect();
// Parse the JSON output from the compiler and extract out the messages.
let actual_errors = json::parse_output(&diagnostic_file_name, &proc_res.stderr, proc_res);
let actual_errors = json::parse_output(&diagnostic_file_name, &self.get_output(proc_res))
.into_iter()
.map(|e| Error { msg: self.normalize_output(&e.msg, &[]), ..e });
let mut unexpected = Vec::new();
let mut found = vec![false; expected_errors.len()];
for mut actual_error in actual_errors {
actual_error.msg = self.normalize_output(&actual_error.msg, &[]);
for actual_error in actual_errors {
for pattern in &self.props.error_patterns {
let pattern = pattern.trim();
if actual_error.msg.contains(pattern) {
let q = if actual_error.line_num.is_none() { "?" } else { "" };
self.fatal(&format!(
"error pattern '{pattern}' is found in structured \
diagnostics, use `//~{q} {} {pattern}` instead",
actual_error.kind,
));
}
}
let opt_index =
expected_errors.iter().enumerate().position(|(index, expected_error)| {

View file

@ -100,16 +100,8 @@ impl TestCx<'_> {
self.check_no_compiler_crash(&proc_res, self.props.should_ice);
let output_to_check = self.get_output(&proc_res);
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
if !expected_errors.is_empty() {
if !self.props.error_patterns.is_empty() || !self.props.regex_error_patterns.is_empty()
{
self.fatal("both error pattern and expected errors specified");
}
self.check_expected_errors(expected_errors, &proc_res);
} else {
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
}
self.check_expected_errors(&proc_res);
self.check_all_error_patterns(&output_to_check, &proc_res);
if self.props.should_ice {
match proc_res.status.code() {
Some(101) => (),
@ -137,6 +129,6 @@ impl TestCx<'_> {
let output_to_check = self.get_output(&proc_res);
self.check_correct_failure_status(&proc_res);
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
self.check_all_error_patterns(&output_to_check, &proc_res);
}
}

View file

@ -9,7 +9,7 @@ use super::{
AllowUnused, Emit, FailMode, LinkToAux, PassMode, TargetLocation, TestCx, TestOutput,
Truncated, UI_FIXED, WillExecute,
};
use crate::{errors, json};
use crate::json;
impl TestCx<'_> {
pub(super) fn run_ui_test(&self) {
@ -127,9 +127,7 @@ impl TestCx<'_> {
);
}
let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
if let WillExecute::Yes = should_run {
let output_to_check = if let WillExecute::Yes = should_run {
let proc_res = self.exec_compiled_test();
let run_output_errors = if self.props.check_run_results {
self.load_compare_outputs(&proc_res, TestOutput::Run, explicit)
@ -150,44 +148,19 @@ impl TestCx<'_> {
self.fatal_proc_rec("test run succeeded!", &proc_res);
}
let output_to_check = self.get_output(&proc_res);
if !self.props.error_patterns.is_empty() || !self.props.regex_error_patterns.is_empty()
{
// "// error-pattern" comments
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
}
self.check_forbid_output(&output_to_check, &proc_res)
}
self.get_output(&proc_res)
} else {
self.get_output(&proc_res)
};
debug!(
"run_ui_test: explicit={:?} config.compare_mode={:?} expected_errors={:?} \
"run_ui_test: explicit={:?} config.compare_mode={:?} \
proc_res.status={:?} props.error_patterns={:?}",
explicit,
self.config.compare_mode,
expected_errors,
proc_res.status,
self.props.error_patterns
explicit, self.config.compare_mode, proc_res.status, self.props.error_patterns
);
if !explicit && self.config.compare_mode.is_none() {
// "//~ERROR comments"
self.check_expected_errors(expected_errors, &proc_res);
} else if explicit && !expected_errors.is_empty() {
let msg = format!(
"line {}: cannot combine `--error-format` with {} annotations; use `error-pattern` instead",
expected_errors[0].line_num_str(),
expected_errors[0].kind,
);
self.fatal(&msg);
}
let output_to_check = self.get_output(&proc_res);
if should_run == WillExecute::No
&& (!self.props.error_patterns.is_empty()
|| !self.props.regex_error_patterns.is_empty())
{
// "// error-pattern" comments
self.check_all_error_patterns(&output_to_check, &proc_res, pm);
}
self.check_expected_errors(&proc_res);
self.check_all_error_patterns(&output_to_check, &proc_res);
self.check_forbid_output(&output_to_check, &proc_res);
if self.props.run_rustfix && self.config.compare_mode.is_none() {

View file

@ -7,6 +7,7 @@
#![crate_type = "rlib"]
#![feature(rustc_attrs)]
#![allow(dead_code)]
#[rustc_clean(except = "opt_hir_owner_nodes", cfg = "cfail2")]
pub fn foo() {

View file

@ -12,5 +12,5 @@ extern crate incremental_proc_macro_aux;
#[derive(IncrementalMacro)]
pub struct Foo {
x: u32
_x: u32
}

View file

@ -10,7 +10,7 @@
mod tests {
#[cfg_attr(not(cfail1), test)]
fn test() {
fn _test() {
}
}

View file

@ -1,5 +1,6 @@
//@ revisions: cfail1 cfail2
//@ build-pass
//@ needs-crate-type: cdylib
#![crate_type="lib"]
#![crate_type="cdylib"]

View file

@ -4,6 +4,8 @@
//@ edition: 2021
//@ build-pass
#![allow(dead_code)]
use core::any::Any;
use core::marker::PhantomData;

View file

@ -1,6 +1,7 @@
//@ revisions:cfail1 cfail2
//@ check-pass
//@ compile-flags: --crate-type cdylib
//@ needs-crate-type: cdylib
#![deny(unused_attributes)]

View file

@ -33,12 +33,12 @@
mod foo {
// Trivial functions like this one are imported very reliably by ThinLTO.
#[cfg(any(cfail1, cfail4))]
#[cfg(cfail1)]
pub fn inlined_fn() -> u32 {
1234
}
#[cfg(not(any(cfail1, cfail4)))]
#[cfg(not(cfail1))]
pub fn inlined_fn() -> u32 {
1234
}

View file

@ -8,6 +8,8 @@
//@ compile-flags: --crate-type=lib
//@ build-pass
#![allow(dead_code)]
pub trait P {
type A;
}

View file

@ -1,8 +1,6 @@
//@ compile-flags: -Ztreat-err-as-bug
//@ rustc-env:RUSTC_ICE=0
//@ failure-status: 101
//@ error-pattern: aborting due to
//@ error-pattern: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md
//@ normalize-stderr: "note: compiler flags.*\n\n" -> ""
//@ normalize-stderr: "note: rustc.*running on.*" -> "note: rustc {version} running on {platform}"
@ -13,3 +11,6 @@
fn wrong()
//~^ ERROR expected one of
//~? RAW aborting due to
//~? RAW we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-rustdoc&template=ice.md

View file

@ -1,5 +1,5 @@
error: internal compiler error: expected one of `->`, `where`, or `{`, found `<eof>`
--> $DIR/ice-bug-report-url.rs:14:10
--> $DIR/ice-bug-report-url.rs:12:10
|
LL | fn wrong()
| ^ expected one of `->`, `where`, or `{`

View file

@ -1,6 +1,5 @@
//@ compile-flags:--test --error-format=short
//@ check-stdout
//@ error-pattern:cannot find function `foo`
//@ normalize-stdout: "tests/rustdoc-ui/issues" -> "$$DIR"
//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
//@ failure-status: 101
@ -11,3 +10,5 @@
fn foo() {
println!("Hello, world!");
}
//~? RAW cannot find function `foo`

View file

@ -1,16 +1,16 @@
running 1 test
test $DIR/issue-81662-shortness.rs - foo (line 8) ... FAILED
test $DIR/issue-81662-shortness.rs - foo (line 7) ... FAILED
failures:
---- $DIR/issue-81662-shortness.rs - foo (line 8) stdout ----
$DIR/issue-81662-shortness.rs:9:1: error[E0425]: cannot find function `foo` in this scope: not found in this scope
---- $DIR/issue-81662-shortness.rs - foo (line 7) stdout ----
$DIR/issue-81662-shortness.rs:8:1: error[E0425]: cannot find function `foo` in this scope: not found in this scope
error: aborting due to 1 previous error
Couldn't compile the test.
failures:
$DIR/issue-81662-shortness.rs - foo (line 8)
$DIR/issue-81662-shortness.rs - foo (line 7)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME

View file

@ -1,10 +1,11 @@
//@ compile-flags: -W help
//@ check-pass
//@ check-stdout
//@ error-pattern:Lint checks provided
//@ error-pattern:rustdoc::broken-intra-doc-links
//
// ignore-tidy-linelength
//
//@ normalize-stdout: "( +name default meaning\n +---- ------- -------\n)?( *[[:word:]:-]+ (allow |warn |deny |forbid ) [^\n]+\n)+" -> " $$NAMES $$LEVELS $$MEANINGS"
//@ normalize-stdout: " +name sub-lints\n +---- ---------\n( *[[:word:]:-]+ [^\n]+\n)+" -> " $$NAMES $$SUB_LINTS"
//~? RAW Lint checks provided
//~? RAW rustdoc::broken-intra-doc-links

View file

@ -1,6 +1,7 @@
//@ compile-flags: --error-format human-annotate-rs -Z unstable-options
//@ error-pattern:cannot find type `Iter` in this scope
pub fn main() {
let x: Iter;
}
//~? RAW cannot find type `Iter` in this scope

View file

@ -1,5 +1,5 @@
error[E0412]: cannot find type `Iter` in this scope
--> $DIR/missing-type.rs:5:12
--> $DIR/missing-type.rs:4:12
|
LL | let x: Iter;
| ^^^^ not found in this scope

View file

@ -1,5 +1,4 @@
//@ proc-macro: multispan.rs
//@ error-pattern:hello to you, too!
//@ compile-flags: --error-format human-annotate-rs -Z unstable-options
#![feature(proc_macro_hygiene)]
@ -27,3 +26,5 @@ fn main() {
hello!(whoah. hi di hi di ho);
hello!(hi good hi and good bye);
}
//~? RAW hello to you, too!

View file

@ -1,41 +1,41 @@
error: hello to you, too!
--> $DIR/multispan.rs:16:5
--> $DIR/multispan.rs:15:5
|
LL | hello!(hi);
| ^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:19:5
--> $DIR/multispan.rs:18:5
|
LL | hello!(hi hi);
| ^^^^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:22:5
--> $DIR/multispan.rs:21:5
|
LL | hello!(hi hi hi);
| ^^^^^^^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:25:5
--> $DIR/multispan.rs:24:5
|
LL | hello!(hi hey hi yo hi beep beep hi hi);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:26:5
--> $DIR/multispan.rs:25:5
|
LL | hello!(hi there, hi how are you? hi... hi.);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:27:5
--> $DIR/multispan.rs:26:5
|
LL | hello!(whoah. hi di hi di ho);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
error: hello to you, too!
--> $DIR/multispan.rs:28:5
--> $DIR/multispan.rs:27:5
|
LL | hello!(hi good hi and good bye);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -38,10 +38,11 @@
// also affected by `RUSTC_BOOTSTRAP`.
//@[force_stable] rustc-env:RUSTC_BOOTSTRAP=-1
//@[force_stable] compile-flags: -Z unstable-options
//@[force_stable] regex-error-pattern: error: the option `Z` is only accepted on the nightly compiler
#![crate_type = "lib"]
// Note: `rustc_attrs` is a perma-unstable internal feature that is unlikely to change, which is
// used as a proxy to check `RUSTC_BOOTSTRAP` versus stability checking logic.
#![feature(rustc_attrs)]
//[force_stable]~? RAW the option `Z` is only accepted on the nightly compiler

View file

@ -4,4 +4,5 @@
// next flag as the argument of this flag.
//
//@ compile-flags: --cap-lints
//@ error-pattern: Argument to option 'cap-lints' missing
//~? RAW Argument to option 'cap-lints' missing

View file

@ -1,5 +1,6 @@
// Regression test for issue #89358.
//@ compile-flags: --cfg a"
//@ error-pattern: unterminated double quote string
//@ error-pattern: this error occurred on the command line
//~? RAW unterminated double quote string
//~? RAW this error occurred on the command line

View file

@ -1,6 +1,3 @@
// ignore-tidy-linelength
// FIXME(#140620)~ ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
// Make sure the compiler does not ICE when trying to generate the debuginfo name of a type that
// causes a layout error.
// This version of the test already ICE'd before the commit that introduce the ICE described in
@ -8,7 +5,6 @@
//@ compile-flags:-C debuginfo=2 --error-format=human
//@ build-fail
//@ error-pattern: values of the type `[u8; usize::MAX]` are too big for the target architecture
#![crate_type = "rlib"]
@ -21,4 +17,4 @@ pub fn foo() -> usize {
}
// FIXME(#140620): the error is reported on different lines on different targets
//FIXME(#140620)~? ERROR values of the type `[u8; usize::MAX]` are too big for the target architecture
//~? RAW values of the type `[u8; usize::MAX]` are too big for the target architecture

View file

@ -1,9 +1,10 @@
//@ compile-flags: --diagnostic-width=20 --error-format=json
//@ error-pattern:expected `()`, found integer
// This test checks that `-Z output-width` effects the JSON error output by restricting it to an
// arbitrarily low value so that the effect is visible.
fn main() {
let _: () = 42;
let _: () = 42; //~ ERROR mismatched types
//~| NOTE expected `()`, found integer
//~| NOTE expected due to this
}

View file

@ -24,10 +24,10 @@ This error occurs when an expression was used in a place where the compiler
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":291,"byte_end":293,"line_start":8,"line_end":8,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;","highlight_start":17,"highlight_end":19}],"label":"expected `()`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/flag-json.rs","byte_start":286,"byte_end":288,"line_start":8,"line_end":8,"column_start":12,"column_end":14,"is_primary":false,"text":[{"text":" let _: () = 42;","highlight_start":12,"highlight_end":14}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0308]: mismatched types
--> $DIR/flag-json.rs:8:17
"},"level":"error","spans":[{"file_name":"$DIR/flag-json.rs","byte_start":244,"byte_end":246,"line_start":7,"line_end":7,"column_start":17,"column_end":19,"is_primary":true,"text":[{"text":" let _: () = 42;
--> $DIR/flag-json.rs:7:17
|
LL | ..._: () = 42;
LL | ..._: () = 42; /...
| -- ^^ expected `()`, found integer
| |
| expected due to this

View file

@ -1,7 +1,6 @@
// Make sure "highlighted" code is colored purple
//@ compile-flags: --error-format=human --color=always
//@ error-pattern:for<'a> 
//@ edition:2018
use core::pin::Pin;
@ -21,3 +20,5 @@ fn wrapped_fn<'a>(_: Box<(dyn Any + Send)>) -> Pin<Box<(
fn main() {
query(wrapped_fn);
}
//~? RAW for<'a> 

View file

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:21:11</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -43,7 +43,7 @@
</tspan>
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:10:4</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before After
Before After

View file

@ -24,7 +24,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="fg-ansi256-015 bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:21:11</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -44,7 +44,7 @@
</tspan>
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:10:4</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Before After
Before After

View file

@ -1,5 +1,4 @@
//@ compile-flags: --error-format=human --color=always
//@ error-pattern: missing lifetime specifier
fn short(foo_bar: &Vec<&i32>) -> &i32 {
&12
@ -17,3 +16,5 @@ fn long2(
&12
}
fn main() {}
//~? RAW missing lifetime specifier

View file

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:3:34</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -47,7 +47,7 @@
</tspan>
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:10:6</tspan>
</tspan>
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -83,7 +83,7 @@
</tspan>
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:15:29</tspan>
</tspan>
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 9 KiB

After

Width:  |  Height:  |  Size: 9 KiB

Before After
Before After

View file

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:3:34</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -47,7 +47,7 @@
</tspan>
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:10:6</tspan>
</tspan>
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -83,7 +83,7 @@
</tspan>
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:15:29</tspan>
</tspan>
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Before After
Before After

View file

@ -1,6 +1,5 @@
//@ only-linux
//@ compile-flags: --error-format=human --color=always
//@ error-pattern: the trait bound
trait Foo<T>: Bar<T> {}
@ -18,3 +17,5 @@ fn foo() -> impl Foo<i32> {
}
fn main() {}
//~? RAW the trait bound

View file

@ -1,4 +1,4 @@
<svg width="1104px" height="398px" xmlns="http://www.w3.org/2000/svg">
<svg width="1028px" height="398px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0277]</tspan><tspan class="bold">: the trait bound `Struct: Foo&lt;i32&gt;` is not satisfied</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:16:13</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:15:13</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -45,7 +45,7 @@
</tspan>
<tspan x="10px" y="226px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: required for `Struct` to implement `Foo&lt;i32&gt;`</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:11:12</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlight-difference-between-expected-trait-and-found-trait.rs:10:12</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

View file

@ -1,2 +1,3 @@
//@ compile-flags: --emit
//@ error-pattern: Argument to option 'emit' missing
//~? RAW Argument to option 'emit' missing

View file

@ -11,3 +11,8 @@ mod json_bom_plus_crlf_multifile_aux;
fn main() {
json_bom_plus_crlf_multifile_aux::test();
}
//~? ERROR mismatched types
//~? ERROR mismatched types
//~? ERROR mismatched types
//~? ERROR mismatched types

View file

@ -16,13 +16,17 @@
fn main() {
let s : String = 1; // Error in the middle of line.
//~^ ERROR mismatched types
let s : String = 1
; // Error before the newline.
//~^^ ERROR mismatched types
let s : String =
1; // Error after the newline.
//~^ ERROR mismatched types
let s : String = (
); // Error spanning the newline.
//~^^ ERROR mismatched types
}

View file

@ -52,7 +52,7 @@ This error occurs when an expression was used in a place where the compiler
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":732,"byte_end":733,"line_start":20,"line_end":20,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":723,"byte_end":729,"line_start":20,"line_end":20,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":733,"byte_end":733,"line_start":20,"line_end":20,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:20:22: error[E0308]: mismatched types: expected `String`, found integer
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":765,"byte_end":766,"line_start":21,"line_end":21,"column_start":22,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":22,"highlight_end":23}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":756,"byte_end":762,"line_start":21,"line_end":21,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = 1","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":766,"byte_end":766,"line_start":21,"line_end":21,"column_start":23,"column_end":23,"is_primary":true,"text":[{"text":" let s : String = 1","highlight_start":23,"highlight_end":23}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:21:22: error[E0308]: mismatched types: expected `String`, found integer
"}
{"$message_type":"diagnostic","message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
@ -80,7 +80,7 @@ This error occurs when an expression was used in a place where the compiler
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":796,"byte_end":797,"line_start":24,"line_end":24,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":786,"byte_end":792,"line_start":23,"line_end":23,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":797,"byte_end":797,"line_start":24,"line_end":24,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:24:1: error[E0308]: mismatched types: expected `String`, found integer
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":863,"byte_end":864,"line_start":26,"line_end":26,"column_start":1,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":1,"highlight_end":2}],"label":"expected `String`, found integer","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":853,"byte_end":859,"line_start":25,"line_end":25,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String =","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"try using a conversion method","code":null,"level":"help","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":864,"byte_end":864,"line_start":26,"line_end":26,"column_start":2,"column_end":2,"is_primary":true,"text":[{"text":"1; // Error after the newline.","highlight_start":2,"highlight_end":2}],"label":null,"suggested_replacement":".to_string()","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"$DIR/json-bom-plus-crlf.rs:26:1: error[E0308]: mismatched types: expected `String`, found integer
"}
{"$message_type":"diagnostic","message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.
@ -108,7 +108,7 @@ This error occurs when an expression was used in a place where the compiler
expected an expression of a different type. It can occur in several cases, the
most common being when calling a function and passing an argument which has a
different type than the matching type in the function declaration.
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":852,"byte_end":860,"line_start":26,"line_end":27,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":843,"byte_end":849,"line_start":26,"line_end":26,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:26:22: error[E0308]: mismatched types: expected `String`, found `()`
"},"level":"error","spans":[{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":952,"byte_end":960,"line_start":29,"line_end":30,"column_start":22,"column_end":6,"is_primary":true,"text":[{"text":" let s : String = (","highlight_start":22,"highlight_end":23},{"text":" ); // Error spanning the newline.","highlight_start":1,"highlight_end":6}],"label":"expected `String`, found `()`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/json-bom-plus-crlf.rs","byte_start":943,"byte_end":949,"line_start":29,"line_end":29,"column_start":13,"column_end":19,"is_primary":false,"text":[{"text":" let s : String = (","highlight_start":13,"highlight_end":19}],"label":"expected due to this","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-bom-plus-crlf.rs:29:22: error[E0308]: mismatched types: expected `String`, found `()`
"}
{"$message_type":"diagnostic","message":"aborting due to 4 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 4 previous errors
"}

View file

@ -1 +1,2 @@
//~v ERROR `main` function not found in crate `json_short`
//@ compile-flags: --json=diagnostic-short --error-format=json

View file

@ -13,7 +13,7 @@ If you don't know the basics of Rust, you can look at the
[Rust Book][rust-book] to get started.
[rust-book]: https://doc.rust-lang.org/book/
"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":63,"byte_end":63,"line_start":1,"line_end":1,"column_start":64,"column_end":64,"is_primary":true,"text":[{"text":"//@ compile-flags: --json=diagnostic-short --error-format=json","highlight_start":64,"highlight_end":64}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:1:64: error[E0601]: `main` function not found in crate `json_short`: consider adding a `main` function to `$DIR/json-short.rs`
"},"level":"error","spans":[{"file_name":"$DIR/json-short.rs","byte_start":122,"byte_end":122,"line_start":2,"line_end":2,"column_start":64,"column_end":64,"is_primary":true,"text":[{"text":"//@ compile-flags: --json=diagnostic-short --error-format=json","highlight_start":64,"highlight_end":64}],"label":"consider adding a `main` function to `$DIR/json-short.rs`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"$DIR/json-short.rs:2:64: error[E0601]: `main` function not found in crate `json_short`: consider adding a `main` function to `$DIR/json-short.rs`
"}
{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 1 previous error
"}

View file

@ -1,5 +1,4 @@
//@ compile-flags: --error-format json
//@ error-pattern:unnecessary parentheses
//@ run-rustfix
// The output for humans should just highlight the whole span without showing
@ -15,6 +14,7 @@ fn main() {
// We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
// the malformed `1 / (2 + 3`
let _a = 1 / (2 + 3);
//~^ ERROR unnecessary parentheses around assigned value
f();
}

View file

@ -1,5 +1,4 @@
//@ compile-flags: --error-format json
//@ error-pattern:unnecessary parentheses
//@ run-rustfix
// The output for humans should just highlight the whole span without showing
@ -15,6 +14,7 @@ fn main() {
// We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
// the malformed `1 / (2 + 3`
let _a = (1 / (2 + 3));
//~^ ERROR unnecessary parentheses around assigned value
f();
}

View file

@ -1,11 +1,11 @@
{"$message_type":"diagnostic","message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":636,"byte_end":637,"line_start":17,"line_end":17,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":648,"byte_end":649,"line_start":17,"line_end":17,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":439,"byte_end":452,"line_start":11,"line_end":11,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":636,"byte_end":637,"line_start":17,"line_end":17,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":648,"byte_end":649,"line_start":17,"line_end":17,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around assigned value
--> $DIR/unused_parens_json_suggestion.rs:17:14
{"$message_type":"diagnostic","message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":594,"byte_end":595,"line_start":16,"line_end":16,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":397,"byte_end":410,"line_start":10,"line_end":10,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":594,"byte_end":595,"line_start":16,"line_end":16,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":606,"byte_end":607,"line_start":16,"line_end":16,"column_start":26,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));","highlight_start":26,"highlight_end":27}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around assigned value
--> $DIR/unused_parens_json_suggestion.rs:16:14
|
LL | let _a = (1 / (2 + 3));
| ^ ^
|
note: the lint level is defined here
--> $DIR/unused_parens_json_suggestion.rs:11:9
--> $DIR/unused_parens_json_suggestion.rs:10:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^

View file

@ -1,5 +1,4 @@
//@ compile-flags: --error-format json
//@ error-pattern:unnecessary parentheses
//@ run-rustfix
// The output for humans should just highlight the whole span without showing
@ -16,6 +15,7 @@ fn main() {
let _b = false;
if _b {
//~^ ERROR unnecessary parentheses around `if` condition
println!("hello");
}
@ -27,28 +27,36 @@ fn f() -> bool {
let c = false;
if c {
//~^ ERROR unnecessary parentheses around `if` condition
println!("next");
}
if c {
//~^ ERROR unnecessary parentheses around `if` condition
println!("prev");
}
while false && true {
//~^ ERROR unnecessary parentheses around `while` condition
if c {
//~^ ERROR unnecessary parentheses around `if` condition
println!("norm");
}
}
while true && false {
//~^ ERROR unnecessary parentheses around `while` condition
for _ in 0 .. 3 {
//~^ ERROR unnecessary parentheses around `for` iterator expression
println!("e~")
}
}
for _ in 0 .. 3 {
//~^ ERROR unnecessary parentheses around `for` iterator expression
while true && false {
//~^ ERROR unnecessary parentheses around `while` condition
println!("e~")
}
}

View file

@ -1,5 +1,4 @@
//@ compile-flags: --error-format json
//@ error-pattern:unnecessary parentheses
//@ run-rustfix
// The output for humans should just highlight the whole span without showing
@ -16,6 +15,7 @@ fn main() {
let _b = false;
if (_b) {
//~^ ERROR unnecessary parentheses around `if` condition
println!("hello");
}
@ -27,28 +27,36 @@ fn f() -> bool {
let c = false;
if(c) {
//~^ ERROR unnecessary parentheses around `if` condition
println!("next");
}
if (c){
//~^ ERROR unnecessary parentheses around `if` condition
println!("prev");
}
while (false && true){
//~^ ERROR unnecessary parentheses around `while` condition
if (c) {
//~^ ERROR unnecessary parentheses around `if` condition
println!("norm");
}
}
while(true && false) {
//~^ ERROR unnecessary parentheses around `while` condition
for _ in (0 .. 3){
//~^ ERROR unnecessary parentheses around `for` iterator expression
println!("e~")
}
}
for _ in (0 .. 3) {
//~^ ERROR unnecessary parentheses around `for` iterator expression
while (true && false) {
//~^ ERROR unnecessary parentheses around `while` condition
println!("e~")
}
}

View file

@ -1,11 +1,11 @@
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":540,"byte_end":541,"line_start":18,"line_end":18,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":543,"byte_end":544,"line_start":18,"line_end":18,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":439,"byte_end":452,"line_start":11,"line_end":11,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":540,"byte_end":541,"line_start":18,"line_end":18,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":543,"byte_end":544,"line_start":18,"line_end":18,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:18:8
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":498,"byte_end":499,"line_start":17,"line_end":17,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":501,"byte_end":502,"line_start":17,"line_end":17,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":397,"byte_end":410,"line_start":10,"line_end":10,"column_start":9,"column_end":22,"is_primary":true,"text":[{"text":"#![deny(unused_parens)]","highlight_start":9,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":498,"byte_end":499,"line_start":17,"line_end":17,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":501,"byte_end":502,"line_start":17,"line_end":17,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:17:8
|
LL | if (_b) {
| ^ ^
|
note: the lint level is defined here
--> $DIR/unused_parens_remove_json_suggestion.rs:11:9
--> $DIR/unused_parens_remove_json_suggestion.rs:10:9
|
LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
@ -16,7 +16,7 @@ LL + if _b {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":637,"byte_end":638,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":639,"byte_end":640,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":637,"byte_end":638,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":639,"byte_end":640,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":656,"byte_end":657,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":658,"byte_end":659,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":656,"byte_end":657,"line_start":29,"line_end":29,"column_start":7,"column_end":8,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":7,"highlight_end":8}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":658,"byte_end":659,"line_start":29,"line_end":29,"column_start":9,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {","highlight_start":9,"highlight_end":10}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:29:7
|
LL | if(c) {
@ -29,8 +29,8 @@ LL + if c {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":683,"byte_end":684,"line_start":33,"line_end":33,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":685,"byte_end":686,"line_start":33,"line_end":33,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":683,"byte_end":684,"line_start":33,"line_end":33,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":685,"byte_end":686,"line_start":33,"line_end":33,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:33:8
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":764,"byte_end":765,"line_start":34,"line_end":34,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":766,"byte_end":767,"line_start":34,"line_end":34,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":764,"byte_end":765,"line_start":34,"line_end":34,"column_start":8,"column_end":9,"is_primary":true,"text":[{"text":" if (c){","highlight_start":8,"highlight_end":9}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":766,"byte_end":767,"line_start":34,"line_end":34,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" if (c){","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:34:8
|
LL | if (c){
| ^ ^
@ -42,8 +42,8 @@ LL + if c {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":731,"byte_end":732,"line_start":37,"line_end":37,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":745,"byte_end":746,"line_start":37,"line_end":37,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":731,"byte_end":732,"line_start":37,"line_end":37,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":745,"byte_end":746,"line_start":37,"line_end":37,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:37:11
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":874,"byte_end":875,"line_start":39,"line_end":39,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":888,"byte_end":889,"line_start":39,"line_end":39,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":874,"byte_end":875,"line_start":39,"line_end":39,"column_start":11,"column_end":12,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":12}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":888,"byte_end":889,"line_start":39,"line_end":39,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:39:11
|
LL | while (false && true){
| ^ ^
@ -55,8 +55,8 @@ LL + while false && true {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":759,"byte_end":760,"line_start":38,"line_end":38,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":761,"byte_end":762,"line_start":38,"line_end":38,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":759,"byte_end":760,"line_start":38,"line_end":38,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":761,"byte_end":762,"line_start":38,"line_end":38,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:38:12
{"$message_type":"diagnostic","message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":966,"byte_end":967,"line_start":41,"line_end":41,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":968,"byte_end":969,"line_start":41,"line_end":41,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":966,"byte_end":967,"line_start":41,"line_end":41,"column_start":12,"column_end":13,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":12,"highlight_end":13}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":968,"byte_end":969,"line_start":41,"line_end":41,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `if` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:41:12
|
LL | if (c) {
| ^ ^
@ -68,8 +68,8 @@ LL + if c {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":822,"byte_end":823,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":836,"byte_end":837,"line_start":44,"line_end":44,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":822,"byte_end":823,"line_start":44,"line_end":44,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":836,"byte_end":837,"line_start":44,"line_end":44,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:44:10
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1094,"byte_end":1095,"line_start":48,"line_end":48,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1108,"byte_end":1109,"line_start":48,"line_end":48,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1094,"byte_end":1095,"line_start":48,"line_end":48,"column_start":10,"column_end":11,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":10,"highlight_end":11}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1108,"byte_end":1109,"line_start":48,"line_end":48,"column_start":24,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {","highlight_start":24,"highlight_end":25}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:48:10
|
LL | while(true && false) {
| ^ ^
@ -81,8 +81,8 @@ LL + while true && false {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":857,"byte_end":858,"line_start":45,"line_end":45,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":864,"byte_end":865,"line_start":45,"line_end":45,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":857,"byte_end":858,"line_start":45,"line_end":45,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":864,"byte_end":865,"line_start":45,"line_end":45,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression
--> $DIR/unused_parens_remove_json_suggestion.rs:45:18
{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1193,"byte_end":1194,"line_start":50,"line_end":50,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1200,"byte_end":1201,"line_start":50,"line_end":50,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1193,"byte_end":1194,"line_start":50,"line_end":50,"column_start":18,"column_end":19,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":18,"highlight_end":19}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1200,"byte_end":1201,"line_start":50,"line_end":50,"column_start":25,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){","highlight_start":25,"highlight_end":26}],"label":null,"suggested_replacement":" ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression
--> $DIR/unused_parens_remove_json_suggestion.rs:50:18
|
LL | for _ in (0 .. 3){
| ^ ^
@ -94,8 +94,8 @@ LL + for _ in 0 .. 3 {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":924,"byte_end":925,"line_start":50,"line_end":50,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":931,"byte_end":932,"line_start":50,"line_end":50,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":924,"byte_end":925,"line_start":50,"line_end":50,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":931,"byte_end":932,"line_start":50,"line_end":50,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression
--> $DIR/unused_parens_remove_json_suggestion.rs:50:14
{"$message_type":"diagnostic","message":"unnecessary parentheses around `for` iterator expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1336,"byte_end":1337,"line_start":56,"line_end":56,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1343,"byte_end":1344,"line_start":56,"line_end":56,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1336,"byte_end":1337,"line_start":56,"line_end":56,"column_start":14,"column_end":15,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":14,"highlight_end":15}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1343,"byte_end":1344,"line_start":56,"line_end":56,"column_start":21,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {","highlight_start":21,"highlight_end":22}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `for` iterator expression
--> $DIR/unused_parens_remove_json_suggestion.rs:56:14
|
LL | for _ in (0 .. 3) {
| ^ ^
@ -107,8 +107,8 @@ LL + for _ in 0 .. 3 {
|
"}
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":949,"byte_end":950,"line_start":51,"line_end":51,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":963,"byte_end":964,"line_start":51,"line_end":51,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":949,"byte_end":950,"line_start":51,"line_end":51,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":963,"byte_end":964,"line_start":51,"line_end":51,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:51:15
{"$message_type":"diagnostic","message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1433,"byte_end":1434,"line_start":58,"line_end":58,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1447,"byte_end":1448,"line_start":58,"line_end":58,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1433,"byte_end":1434,"line_start":58,"line_end":58,"column_start":15,"column_end":16,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":15,"highlight_end":16}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null},{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1447,"byte_end":1448,"line_start":58,"line_end":58,"column_start":29,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {","highlight_start":29,"highlight_end":30}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
--> $DIR/unused_parens_remove_json_suggestion.rs:58:15
|
LL | while (true && false) {
| ^ ^

View file

@ -2,7 +2,7 @@
//@ build-fail
//@ failure-status: 101
//@ dont-check-compiler-stderr
//@ error-pattern: encountered `Assign` statement with overlapping memory
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;
@ -13,6 +13,7 @@ pub fn main() {
let a: [u8; 1024];
{
a = a; //~ ERROR broken MIR
//~^ ERROR encountered `Assign` statement with overlapping memory
Return()
}
}

View file

@ -2,7 +2,7 @@
//@ build-fail
//@ failure-status: 101
//@ dont-check-compiler-stderr
//@ error-pattern: encountered overlapping memory in `Move` arguments to `Call`
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;
@ -13,6 +13,7 @@ pub fn main() {
let a: [u8; 1024];
{
Call(a = f(Move(a)), ReturnTo(bb1), UnwindUnreachable()) //~ ERROR broken MIR
//~^ ERROR encountered overlapping memory in `Move` arguments to `Call`
}
bb1 = {
Return()

View file

@ -1,7 +1,5 @@
//@ compile-flags: -Zlint-mir -Ztreat-err-as-bug
//@ failure-status: 101
//@ error-pattern: broken MIR in
//@ error-pattern: StorageLive(_1) which already has storage here
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> ""
//@ normalize-stderr: "storage_live\[....\]" -> "storage_live[HASH]"
@ -21,6 +19,7 @@ fn multiple_storage() {
{
StorageLive(a);
StorageLive(a); //~ ERROR broken MIR
//~| ERROR StorageLive(_1) which already has storage here
Return()
}
}

View file

@ -1,12 +1,12 @@
error: internal compiler error: broken MIR in Item(DefId(0:8 ~ storage_live[HASH]::multiple_storage)) (after pass CheckForceInline) at bb0[1]:
StorageLive(_1) which already has storage here
--> $DIR/storage-live.rs:23:13
--> $DIR/storage-live.rs:21:13
|
LL | StorageLive(a);
| ^^^^^^^^^^^^^^
|
note: delayed at compiler/rustc_mir_transform/src/lint.rs:LL:CC - disabled backtrace
--> $DIR/storage-live.rs:23:13
--> $DIR/storage-live.rs:21:13
|
LL | StorageLive(a);
| ^^^^^^^^^^^^^^

View file

@ -1,7 +1,7 @@
//@ compile-flags: -Zlint-mir -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs
//@ failure-status: 101
//@ dont-check-compiler-stderr
//@ error-pattern: has storage when returning
#![feature(custom_mir, core_intrinsics)]
extern crate core;
use core::intrinsics::mir::*;
@ -14,6 +14,7 @@ fn main() {
StorageLive(a);
RET = a;
Return() //~ ERROR broken MIR
//~^ ERROR has storage when returning
}
}
}

View file

@ -5,7 +5,7 @@
//@ compile-flags: --crate-type=lib
//@ failure-status: 101
//@ dont-check-compiler-stderr
//@ error-pattern: encountered critical edge in `Call` terminator
#![feature(custom_mir, core_intrinsics)]
use core::intrinsics::mir::*;
@ -29,3 +29,5 @@ pub fn f(a: u32) -> u32 {
}
}
}
//~? RAW encountered critical edge in `Call` terminator

View file

@ -1,8 +1,5 @@
//@ unset-rustc-env:RUST_BACKTRACE
//@ compile-flags:-Z treat-err-as-bug=1
//@ error-pattern:stack backtrace:
// Verify this is a full backtrace, not a short backtrace.
//@ error-pattern:__rust_begin_short_backtrace
//@ failure-status:101
//@ ignore-msvc
//@ normalize-stderr: "note: .*" -> ""
@ -21,3 +18,7 @@
// aren't reliable.
fn main() { missing_ident; } //~ ERROR cannot find value `missing_ident` in this scope
//~? RAW stack backtrace:
// Verify this is a full backtrace, not a short backtrace.
//~? RAW __rust_begin_short_backtrace

View file

@ -1,5 +1,5 @@
error: internal compiler error[E0425]: cannot find value `missing_ident` in this scope
--> $DIR/default-backtrace-ice.rs:23:13
--> $DIR/default-backtrace-ice.rs:20:13
|
LL | fn main() { missing_ident; }
| ^^^^^^^^^^^^^ not found in this scope

View file

@ -1,7 +1,5 @@
//@ compile-flags: -Ztreat-err-as-bug
//@ failure-status: 101
//@ error-pattern: aborting due to `-Z treat-err-as-bug=1`
//@ error-pattern: [eval_static_initializer] evaluating initializer of static `C`
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> ""
//@ rustc-env:RUST_BACKTRACE=0
@ -10,3 +8,6 @@
pub static C: u32 = 0 - 1;
//~^ ERROR could not evaluate static initializer
//~? RAW aborting due to `-Z treat-err-as-bug=1`
//~? RAW [eval_static_initializer] evaluating initializer of static `C`

View file

@ -1,5 +1,5 @@
error: internal compiler error[E0080]: could not evaluate static initializer
--> $DIR/err.rs:11:21
--> $DIR/err.rs:9:21
|
LL | pub static C: u32 = 0 - 1;
| ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow

View file

@ -1,6 +1,5 @@
//@ compile-flags: -Ztreat-err-as-bug
//@ dont-check-failure-status
//@ error-pattern: aborting due to `-Z treat-err-as-bug=1`
//@ dont-check-compiler-stderr
//@ rustc-env:RUST_BACKTRACE=0
@ -8,3 +7,5 @@ fn main() {
#[deny(while_true)]
while true {} //~ ERROR denote infinite loops with `loop { ... }`
}
//~? RAW aborting due to `-Z treat-err-as-bug=1`

View file

@ -1,7 +1,5 @@
//@ compile-flags: -Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs
//@ failure-status: 101
//@ error-pattern: aborting due to `-Z treat-err-as-bug=1`
//@ error-pattern: [trigger_delayed_bug] triggering a delayed bug for testing incremental
//@ normalize-stderr: "note: .*\n\n" -> ""
//@ normalize-stderr: "thread 'rustc' panicked.*:\n.*\n" -> ""
//@ rustc-env:RUST_BACKTRACE=0
@ -10,3 +8,6 @@
#[rustc_delayed_bug_from_inside_query]
fn main() {} //~ ERROR delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
//~? RAW aborting due to `-Z treat-err-as-bug=1`
//~? RAW [trigger_delayed_bug] triggering a delayed bug for testing incremental

View file

@ -1,5 +1,5 @@
error: internal compiler error: delayed bug triggered by #[rustc_delayed_bug_from_inside_query]
--> $DIR/span_delayed_bug.rs:12:1
--> $DIR/span_delayed_bug.rs:10:1
|
LL | fn main() {}
| ^^^^^^^^^

View file

@ -3,8 +3,9 @@
//@ check-stdout
//@ dont-check-compiler-stdout
//@ dont-check-compiler-stderr
//@ regex-error-pattern: Hello, Rustaceans!
fn main() {
println!("Hello, Rustaceans!");
}
//~? RAW Hello, Rustaceans!