mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Auto merge of #113127 - jieyouxu:fix-error-color-summary, r=davidtwco
Set error handler output format as soon as possible Should fix https://github.com/rust-lang/rust/pull/112692#issuecomment-1611585904.
This commit is contained in:
commit
02d1ee4834
@ -2524,6 +2524,8 @@ pub fn build_session_options(
|
|||||||
|
|
||||||
let error_format = parse_error_format(handler, matches, color, json_rendered);
|
let error_format = parse_error_format(handler, matches, color, json_rendered);
|
||||||
|
|
||||||
|
handler.abort_if_error_and_set_error_format(error_format);
|
||||||
|
|
||||||
let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_else(|_| {
|
let diagnostic_width = matches.opt_get("diagnostic-width").unwrap_or_else(|_| {
|
||||||
handler.early_error("`--diagnostic-width` must be an positive integer");
|
handler.early_error("`--diagnostic-width` must be an positive integer");
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// compile-flags: --cfg a(b=c)
|
// compile-flags: --error-format=human --cfg a(b=c)
|
||||||
// error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
|
// error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// compile-flags: --cfg a{b}
|
// compile-flags: --error-format=human --cfg a{b}
|
||||||
// error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)
|
// error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// compile-flags: --cfg a(b)
|
// compile-flags: --error-format=human --cfg a(b)
|
||||||
// error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)
|
// error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// compile-flags: --cfg a{
|
// compile-flags: --error-format=human --cfg a{
|
||||||
// error-pattern: invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)
|
// error-pattern: invalid `--cfg` argument: `a{` (expected `key` or `key="value"`)
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// compile-flags: --cfg )
|
// compile-flags: --error-format=human --cfg )
|
||||||
// error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
|
// error-pattern: invalid `--cfg` argument: `)` (expected `key` or `key="value"`)
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Test for missing quotes around value, issue #66450.
|
// Test for missing quotes around value, issue #66450.
|
||||||
// compile-flags: --cfg key=value
|
// compile-flags: --error-format=human --cfg key=value
|
||||||
// error-pattern: invalid `--cfg` argument: `key=value` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
|
// error-pattern: invalid `--cfg` argument: `key=value` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\")
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Tests that empty source_maps don't ICE (#23301)
|
// Tests that empty source_maps don't ICE (#23301)
|
||||||
|
|
||||||
// compile-flags: --cfg ""
|
// compile-flags: --error-format=human --cfg ""
|
||||||
|
|
||||||
// error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)
|
// error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)
|
||||||
|
|
||||||
|
4
tests/ui/diagnostic-flags/colored-session-opt-error.rs
Normal file
4
tests/ui/diagnostic-flags/colored-session-opt-error.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// check-pass
|
||||||
|
// ignore-windows
|
||||||
|
// compile-flags: -Cremark=foo --error-format=human --color always
|
||||||
|
fn main() {}
|
@ -0,0 +1,2 @@
|
|||||||
|
[0m[1m[33mwarning[0m[0m[1m: -C remark requires "-C debuginfo=n" to show source locations[0m
|
||||||
|
|
Loading…
Reference in New Issue
Block a user