From 0ba70520da6e8c6e94d1acfd799c9a016337bc39 Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Mon, 19 Oct 2026 14:39:48 -0600 Subject: [PATCH 1/2] chore: Update annotate-snippets to 0.12.17 --- Cargo.lock | 10 +++++----- compiler/rustc_errors/Cargo.toml | 2 +- .../src/annotate_snippet_emitter_writer.rs | 2 +- compiler/rustc_parse/src/parser/tests.rs | 6 +++--- .../jobserver-error/cannot_open_fd.stderr | 4 ++-- .../run-make/jobserver-error/not_a_pipe.stderr | 4 ++-- .../linker-warning/deny-linker-lint.txt | 4 ++-- .../run-make/linker-warning/deny-warnings.txt | 6 +++--- tests/run-make/linker-warning/short-error.txt | 10 +++++----- .../check-cfg-frontmatter.stderr | 6 +++--- .../check-cfg-shebang.stderr | 6 +++--- .../invalid-print-request-help.err | 4 ++-- .../rustc_bootstrap.force_stable.stderr | 8 ++++---- ...rce_stable_disallow_additional_flags.stderr | 8 ++++---- tests/ui/cfg/invalid-cli-cfg-pred.stderr | 6 +++--- tests/ui/cfg/invalid-cli-check-cfg-pred.stderr | 6 +++--- ...kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr | 4 ++-- ...-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr | 4 ++-- ...-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr | 4 ++-- ...kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr | 4 ++-- ...-cfg-pred-cli-cfg.cfg_raw_underscore.stderr | 4 ++-- ...ed-cli-check-cfg.check_cfg_raw_crate.stderr | 4 ++-- ...i-check-cfg.check_cfg_raw_self_lower.stderr | 4 ++-- ...i-check-cfg.check_cfg_raw_self_upper.stderr | 4 ++-- ...ed-cli-check-cfg.check_cfg_raw_super.stderr | 4 ++-- ...i-check-cfg.check_cfg_raw_underscore.stderr | 4 ++-- .../huge_multispan_highlight.unicode.svg | 8 ++++---- ...typo-suggestion-issue-159482.codegen.stderr | 4 ++-- ...ypo-suggestion-issue-159482.unstable.stderr | 4 ++-- tests/ui/compile-flags/invalid/print.stderr | 6 +++--- ...request-help-stable-unstable.nightly.stderr | 6 +++--- ...-request-help-stable-unstable.stable.stderr | 6 +++--- .../cfg-arg-invalid-7.stderr | 4 ++-- tests/ui/diagnostic-width/E0271.unicode.stderr | 2 +- .../diagnostic-width/long-E0308.ascii.stderr | 14 +++++++------- .../diagnostic-width/long-E0308.unicode.stderr | 18 +++++++++--------- tests/ui/error-emitter/E0308-clarification.svg | 4 ++-- .../ui/errors/unknown-target-suggestion.stderr | 6 +++--- tests/ui/errors/wrong-target-spec.stderr | 6 +++--- .../invalid-crate-name-dashed.stderr | 4 ++-- tests/ui/print-request/print-lints-help.stderr | 8 ++++---- tests/ui/resolve/empty-struct-tuple-pat.stderr | 2 +- tests/ui/resolve/empty-struct-unit-pat.stderr | 4 ++-- tests/ui/rustc-env/min-stack-banana.stderr | 4 ++-- 44 files changed, 121 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a677f5957794..91c246f06b7cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,9 +64,9 @@ dependencies = [ [[package]] name = "annotate-snippets" -version = "0.12.16" +version = "0.12.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f211a51805bc641f3ad5b7664c77d2547af685cc33b4cd8d31964027a46f13f1" +checksum = "b2a5b0a5ab8561c603f16c3b78c24a386b1f70e7fc1b1b1e8c15738828e4a176" dependencies = [ "anstyle", "memchr", @@ -680,7 +680,7 @@ dependencies = [ name = "clippy-dev" version = "0.0.1" dependencies = [ - "annotate-snippets 0.12.16", + "annotate-snippets 0.12.17", "anstream 0.6.21", "chrono", "clap", @@ -4041,7 +4041,7 @@ dependencies = [ name = "rustc_errors" version = "0.0.0" dependencies = [ - "annotate-snippets 0.12.16", + "annotate-snippets 0.12.17", "anstream 0.6.21", "anstyle", "derive_setters", @@ -5179,7 +5179,7 @@ dependencies = [ name = "rustfmt-nightly" version = "1.12.0" dependencies = [ - "annotate-snippets 0.12.16", + "annotate-snippets 0.12.17", "anyhow", "bytecount", "cargo_metadata 0.23.1", diff --git a/compiler/rustc_errors/Cargo.toml b/compiler/rustc_errors/Cargo.toml index b0eed7ae2aad9..7dbdfa316b4a6 100644 --- a/compiler/rustc_errors/Cargo.toml +++ b/compiler/rustc_errors/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] # tidy-alphabetical-start -annotate-snippets = { version = "0.12.16", features = ["simd"] } +annotate-snippets = { version = "0.12.17", features = ["simd"] } anstream = "0.6.20" anstyle = "1.0.13" derive_setters = "0.1.6" diff --git a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs index 15a435357544d..d8b6fc9ecc05b 100644 --- a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs +++ b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs @@ -540,7 +540,7 @@ impl AnnotateSnippetEmitter { ColorChoice::Never => Renderer::plain(), } .term_width(width) - .anonymized_line_numbers(self.ui_testing) + .anonymized_snippet_line_numbers(self.ui_testing) .decor_style(decor_style) .short_message(self.short_message) } diff --git a/compiler/rustc_parse/src/parser/tests.rs b/compiler/rustc_parse/src/parser/tests.rs index 07dc51f9e47cc..1f077d89d16b5 100644 --- a/compiler/rustc_parse/src/parser/tests.rs +++ b/compiler/rustc_parse/src/parser/tests.rs @@ -309,7 +309,7 @@ error: foo │ 2 │ fn foo() { │ ┏━━━━━━━━━━┛ - ‡ ┃ + ┆ ┇ 5 │ ┃ } ╰╴┗━━━┛ test @@ -2126,7 +2126,7 @@ error: foo 5 │ │ 1 6 │ │ 2 7 │ │ 3 - ‡ │ + ┆ ┆ 15 │ │ X2 Y2 Z2 16 │ │ X3 Y3 Z3 ╰╴ └──────────┘ `Y` is a good letter too @@ -2207,7 +2207,7 @@ error: foo 10 │ ┃│ 6 11 │ ┃│ X2 Y2 Z2 │ ┃└──────────┘ `Z` is a good letter too - ‡ ┃ + ┆ ┇ 15 │ ┃ 10 16 │ ┃ X3 Y3 Z3 ╰╴┗━━━━━━━━┛ `Y` is a good letter diff --git a/tests/run-make/jobserver-error/cannot_open_fd.stderr b/tests/run-make/jobserver-error/cannot_open_fd.stderr index d075057b3d3df..716c49afb52dc 100644 --- a/tests/run-make/jobserver-error/cannot_open_fd.stderr +++ b/tests/run-make/jobserver-error/cannot_open_fd.stderr @@ -1,6 +1,6 @@ warning: failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=1000,1000"`: cannot open file descriptor 1000 from the jobserver environment variable value: Bad file descriptor (os error 9) - | - = note: the build environment is likely misconfigured + | + = note: the build environment is likely misconfigured error: no input filename given diff --git a/tests/run-make/jobserver-error/not_a_pipe.stderr b/tests/run-make/jobserver-error/not_a_pipe.stderr index 536c04576b9b9..bb67781c88ae9 100644 --- a/tests/run-make/jobserver-error/not_a_pipe.stderr +++ b/tests/run-make/jobserver-error/not_a_pipe.stderr @@ -1,4 +1,4 @@ warning: failed to connect to jobserver from environment variable `MAKEFLAGS="--jobserver-auth=3,3"`: file descriptor 3 from the jobserver environment variable value is not a pipe - | - = note: the build environment is likely misconfigured + | + = note: the build environment is likely misconfigured diff --git a/tests/run-make/linker-warning/deny-linker-lint.txt b/tests/run-make/linker-warning/deny-linker-lint.txt index cac349f794a46..3b2dbbe4916b0 100644 --- a/tests/run-make/linker-warning/deny-linker-lint.txt +++ b/tests/run-make/linker-warning/deny-linker-lint.txt @@ -1,6 +1,6 @@ error: linker stderr: bar - | - = note: requested on the command line with `-D linker-messages` + | + = note: requested on the command line with `-D linker-messages` error: aborting due to 1 previous error diff --git a/tests/run-make/linker-warning/deny-warnings.txt b/tests/run-make/linker-warning/deny-warnings.txt index 7a187af46f708..329f9e48d0a8d 100644 --- a/tests/run-make/linker-warning/deny-warnings.txt +++ b/tests/run-make/linker-warning/deny-warnings.txt @@ -1,7 +1,7 @@ warning: linker stderr: bar - | - = note: requested on the command line with `-W linker-messages` - = note: the `linker_messages` lint ignores `-D warnings` + | + = note: requested on the command line with `-W linker-messages` + = note: the `linker_messages` lint ignores `-D warnings` warning: 1 warning emitted diff --git a/tests/run-make/linker-warning/short-error.txt b/tests/run-make/linker-warning/short-error.txt index e5861b732c5f0..31b8254162180 100644 --- a/tests/run-make/linker-warning/short-error.txt +++ b/tests/run-make/linker-warning/short-error.txt @@ -1,9 +1,9 @@ error: linking with `./fake-linker` failed: exit status: 1 - | - = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" - = note: some arguments are omitted. use `--verbose` to show all linker arguments - = note: error: baz - + | + = note: "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error" + = note: some arguments are omitted. use `--verbose` to show all linker arguments + = note: error: baz + error: aborting due to 1 previous error diff --git a/tests/run-make/multiline-args-value/check-cfg-frontmatter.stderr b/tests/run-make/multiline-args-value/check-cfg-frontmatter.stderr index 4a499cc0a1e24..4366b0fdfea1a 100644 --- a/tests/run-make/multiline-args-value/check-cfg-frontmatter.stderr +++ b/tests/run-make/multiline-args-value/check-cfg-frontmatter.stderr @@ -1,7 +1,7 @@ error: invalid `--check-cfg` argument: `--- --- cfg(key)` - | - = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` - = note: visit for more details + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit for more details diff --git a/tests/run-make/multiline-args-value/check-cfg-shebang.stderr b/tests/run-make/multiline-args-value/check-cfg-shebang.stderr index 5bf18dc2b14c4..4ce06df0d0b56 100644 --- a/tests/run-make/multiline-args-value/check-cfg-shebang.stderr +++ b/tests/run-make/multiline-args-value/check-cfg-shebang.stderr @@ -1,6 +1,6 @@ error: invalid `--check-cfg` argument: `#!/usr/bin/shebang cfg(key)` - | - = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` - = note: visit for more details + | + = note: expected `cfg(name, values("value1", "value2", ... "valueN"))` + = note: visit for more details diff --git a/tests/run-make/rustdoc/print-request-help/invalid-print-request-help.err b/tests/run-make/rustdoc/print-request-help/invalid-print-request-help.err index 02d14190030bb..8d62b3c540668 100644 --- a/tests/run-make/rustdoc/print-request-help/invalid-print-request-help.err +++ b/tests/run-make/rustdoc/print-request-help/invalid-print-request-help.err @@ -1,4 +1,4 @@ error: unknown print request: `xxx` - | - = help: valid print requests are: `all-target-specs-json`, `cfg`, `check-cfg`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `wasm-proc-macro-tuple` + | + = help: valid print requests are: `all-target-specs-json`, `cfg`, `check-cfg`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `wasm-proc-macro-tuple` diff --git a/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr b/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr index 32f177e752ad0..6315de10e2222 100644 --- a/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr +++ b/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr @@ -1,8 +1,8 @@ error: the option `Z` is only accepted on the nightly compiler error: 1 nightly option was parsed - | - = help: consider switching to a nightly toolchain: `rustup default nightly` - = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see - = note: for more information about Rust's stability policy, see + | + = help: consider switching to a nightly toolchain: `rustup default nightly` + = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see + = note: for more information about Rust's stability policy, see diff --git a/tests/ui/bootstrap/rustc_bootstrap.force_stable_disallow_additional_flags.stderr b/tests/ui/bootstrap/rustc_bootstrap.force_stable_disallow_additional_flags.stderr index 13d619cfc388f..51c5e15f60751 100644 --- a/tests/ui/bootstrap/rustc_bootstrap.force_stable_disallow_additional_flags.stderr +++ b/tests/ui/bootstrap/rustc_bootstrap.force_stable_disallow_additional_flags.stderr @@ -3,8 +3,8 @@ error: the -Zmir-opt-level option was not allowed through `-allow-unstable-compi error: the option `Z` is only accepted on the nightly compiler error: 1 nightly option was parsed - | - = help: consider switching to a nightly toolchain: `rustup default nightly` - = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see - = note: for more information about Rust's stability policy, see + | + = help: consider switching to a nightly toolchain: `rustup default nightly` + = note: selecting a toolchain with `+toolchain` arguments require a rustup proxy; see + = note: for more information about Rust's stability policy, see diff --git a/tests/ui/cfg/invalid-cli-cfg-pred.stderr b/tests/ui/cfg/invalid-cli-cfg-pred.stderr index 2f5ed55a64239..33b4420473c34 100644 --- a/tests/ui/cfg/invalid-cli-cfg-pred.stderr +++ b/tests/ui/cfg/invalid-cli-cfg-pred.stderr @@ -1,7 +1,7 @@ error: invalid suffix `x` for number literal - | - = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) - = note: this occurred on the command line: `--cfg=foo=1x` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + = note: this occurred on the command line: `--cfg=foo=1x` error: invalid `--cfg` argument: `foo=1x` (expected `key` or `key="value"`, ensure escaping is appropriate for your shell, try 'key="value"' or key=\"value\") diff --git a/tests/ui/cfg/invalid-cli-check-cfg-pred.stderr b/tests/ui/cfg/invalid-cli-check-cfg-pred.stderr index be8299aa9edf5..087bb92dd581c 100644 --- a/tests/ui/cfg/invalid-cli-check-cfg-pred.stderr +++ b/tests/ui/cfg/invalid-cli-check-cfg-pred.stderr @@ -1,7 +1,7 @@ error: invalid suffix `x` for number literal - | - = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) - = note: this occurred on the command line: `--check-cfg=foo=1x` + | + = help: the suffix must be one of the numeric types (`u32`, `isize`, `f32`, etc.) + = note: this occurred on the command line: `--check-cfg=foo=1x` error: invalid `--check-cfg` argument: `foo=1x` | diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr index a5f8b25fe4272..6a5f05eaf29a2 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr @@ -1,6 +1,6 @@ error: `crate` cannot be a raw identifier - | - = note: this occurred on the command line: `--cfg=r#crate` + | + = note: this occurred on the command line: `--cfg=r#crate` error: invalid `--cfg` argument: `r#crate` (expected `key` or `key="value"`) diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr index 25dbaa36dbec0..144b6a7fe5411 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr @@ -1,6 +1,6 @@ error: `self` cannot be a raw identifier - | - = note: this occurred on the command line: `--cfg=r#self` + | + = note: this occurred on the command line: `--cfg=r#self` error: invalid `--cfg` argument: `r#self` (expected `key` or `key="value"`) diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr index 04341926143a5..497936f471a37 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr @@ -1,6 +1,6 @@ error: `Self` cannot be a raw identifier - | - = note: this occurred on the command line: `--cfg=r#Self` + | + = note: this occurred on the command line: `--cfg=r#Self` error: invalid `--cfg` argument: `r#Self` (expected `key` or `key="value"`) diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr index 9c70442394cac..c68e111675a67 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr @@ -1,6 +1,6 @@ error: `super` cannot be a raw identifier - | - = note: this occurred on the command line: `--cfg=r#super` + | + = note: this occurred on the command line: `--cfg=r#super` error: invalid `--cfg` argument: `r#super` (expected `key` or `key="value"`) diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr index 144f6a1349896..0f9c15a50e93e 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr @@ -1,6 +1,6 @@ error: `_` cannot be a raw identifier - | - = note: this occurred on the command line: `--cfg=r#_` + | + = note: this occurred on the command line: `--cfg=r#_` error: invalid `--cfg` argument: `r#_` (expected `key` or `key="value"`) diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_crate.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_crate.stderr index f440c07779da0..a4d352edfcb8e 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_crate.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_crate.stderr @@ -1,6 +1,6 @@ error: `crate` cannot be a raw identifier - | - = note: this occurred on the command line: `--check-cfg=cfg(r#crate)` + | + = note: this occurred on the command line: `--check-cfg=cfg(r#crate)` error: invalid `--check-cfg` argument: `cfg(r#crate)` | diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_lower.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_lower.stderr index bccc694084e3b..a48067e1177ef 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_lower.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_lower.stderr @@ -1,6 +1,6 @@ error: `self` cannot be a raw identifier - | - = note: this occurred on the command line: `--check-cfg=cfg(r#self)` + | + = note: this occurred on the command line: `--check-cfg=cfg(r#self)` error: invalid `--check-cfg` argument: `cfg(r#self)` | diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_upper.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_upper.stderr index 68c149a01fb50..7657d4989fd6f 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_upper.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_self_upper.stderr @@ -1,6 +1,6 @@ error: `Self` cannot be a raw identifier - | - = note: this occurred on the command line: `--check-cfg=cfg(r#Self)` + | + = note: this occurred on the command line: `--check-cfg=cfg(r#Self)` error: invalid `--check-cfg` argument: `cfg(r#Self)` | diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_super.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_super.stderr index b3ef744226207..be9973ed9d3fb 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_super.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_super.stderr @@ -1,6 +1,6 @@ error: `super` cannot be a raw identifier - | - = note: this occurred on the command line: `--check-cfg=cfg(r#super)` + | + = note: this occurred on the command line: `--check-cfg=cfg(r#super)` error: invalid `--check-cfg` argument: `cfg(r#super)` | diff --git a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_underscore.stderr b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_underscore.stderr index c05536b4185e1..5aeca83f81a61 100644 --- a/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_underscore.stderr +++ b/tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.check_cfg_raw_underscore.stderr @@ -1,6 +1,6 @@ error: `_` cannot be a raw identifier - | - = note: this occurred on the command line: `--check-cfg=cfg(r#_)` + | + = note: this occurred on the command line: `--check-cfg=cfg(r#_)` error: invalid `--check-cfg` argument: `cfg(r#_)` | diff --git a/tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg b/tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg index fc542eaa4d1fb..7c4ad7504e5fd 100644 --- a/tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg +++ b/tests/ui/codemap_tests/huge_multispan_highlight.unicode.svg @@ -33,7 +33,7 @@ │ ┌─────────────────┘ - ‡ │ + ┆ ┆ LL │ │ ), @@ -43,7 +43,7 @@ │ ┏━━━━━━━━━━━━━━━━━━┛ - ‡ ┃ + ┆ ┇ LL │ ┃ ", @@ -69,7 +69,7 @@ LL │ │ 1 // last line shown in multispan header - ‡ │ + ┆ ┆ LL │ │ ), @@ -85,7 +85,7 @@ LL │ ┃ 1 last line shown in multispan - ‡ ┃ + ┆ ┇ LL │ ┃ ", diff --git a/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.codegen.stderr b/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.codegen.stderr index 613e8a999a692..669866f78acef 100644 --- a/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.codegen.stderr +++ b/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.codegen.stderr @@ -1,4 +1,4 @@ error: unknown codegen option: `opt-leve` - | - = help: you might have meant to use `-C opt-level=` + | + = help: you might have meant to use `-C opt-level=` diff --git a/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.unstable.stderr b/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.unstable.stderr index 49f505aca18ed..b06639e6e3756 100644 --- a/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.unstable.stderr +++ b/tests/ui/compile-flags/invalid/codegen-option-typo-suggestion-issue-159482.unstable.stderr @@ -1,4 +1,4 @@ error: unknown unstable option: `no-analysi` - | - = help: you might have meant to use `-Z no-analysis` + | + = help: you might have meant to use `-Z no-analysis` diff --git a/tests/ui/compile-flags/invalid/print.stderr b/tests/ui/compile-flags/invalid/print.stderr index c7a9e59638e7f..f36db84cdc803 100644 --- a/tests/ui/compile-flags/invalid/print.stderr +++ b/tests/ui/compile-flags/invalid/print.stderr @@ -1,5 +1,5 @@ error: unknown print request: `yyyy` - | - = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` - = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information + | + = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` + = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information diff --git a/tests/ui/compile-flags/print-request-help-stable-unstable.nightly.stderr b/tests/ui/compile-flags/print-request-help-stable-unstable.nightly.stderr index 06842577618c8..0e8b4ac5c4381 100644 --- a/tests/ui/compile-flags/print-request-help-stable-unstable.nightly.stderr +++ b/tests/ui/compile-flags/print-request-help-stable-unstable.nightly.stderr @@ -1,5 +1,5 @@ error: unknown print request: `xxx` - | - = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` - = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information + | + = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` + = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information diff --git a/tests/ui/compile-flags/print-request-help-stable-unstable.stable.stderr b/tests/ui/compile-flags/print-request-help-stable-unstable.stable.stderr index 019a578dad3e0..35cdcc6fa4bb6 100644 --- a/tests/ui/compile-flags/print-request-help-stable-unstable.stable.stderr +++ b/tests/ui/compile-flags/print-request-help-stable-unstable.stable.stderr @@ -1,5 +1,5 @@ error: unknown print request: `xxx` - | - = help: valid print requests are: `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `tls-models` - = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information + | + = help: valid print requests are: `calling-conventions`, `cfg`, `code-models`, `crate-name`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `tls-models` + = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information diff --git a/tests/ui/conditional-compilation/cfg-arg-invalid-7.stderr b/tests/ui/conditional-compilation/cfg-arg-invalid-7.stderr index 833d24a907dc2..9a234731d95d7 100644 --- a/tests/ui/conditional-compilation/cfg-arg-invalid-7.stderr +++ b/tests/ui/conditional-compilation/cfg-arg-invalid-7.stderr @@ -1,4 +1,4 @@ error[E0765]: unterminated double quote string - | - = note: this occurred on the command line: `--cfg=a"` + | + = note: this occurred on the command line: `--cfg=a"` diff --git a/tests/ui/diagnostic-width/E0271.unicode.stderr b/tests/ui/diagnostic-width/E0271.unicode.stderr index ecb09c53a76c6..6d7efea32e433 100644 --- a/tests/ui/diagnostic-width/E0271.unicode.stderr +++ b/tests/ui/diagnostic-width/E0271.unicode.stderr @@ -5,7 +5,7 @@ LL │ ┏ Box::new( LL │ ┃ Ok::<_, ()>( LL │ ┃ Err::<(), _>( LL │ ┃ Ok::<_, ()>( - ‡ ┃ + ┆ ┇ LL │ ┃ ) │ ┗━━━━━┛ type mismatch resolving ` as Future>::Error == Foo` ╰╴ diff --git a/tests/ui/diagnostic-width/long-E0308.ascii.stderr b/tests/ui/diagnostic-width/long-E0308.ascii.stderr index ff384c290359d..59da971387b3f 100644 --- a/tests/ui/diagnostic-width/long-E0308.ascii.stderr +++ b/tests/ui/diagnostic-width/long-E0308.ascii.stderr @@ -26,13 +26,13 @@ LL | | )))))))))))))))))))))))))))))); error[E0308]: mismatched types --> $DIR/long-E0308.rs:58:26 | -LL | ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O... - | __________________________^ -LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... -LL | | Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) -LL | | )))))))))))))))))))))))))))))) -LL | | )))))))))))))))))))))))); - | |____________________________^ expected `Option>, _>>`, found `Result, _>, _>` +LL | ...))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(... + | _____________________^ +LL | | ...Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok... +LL | | ... Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) +LL | | ...)))))))))))))))))))))))))))))) +LL | | ...)))))))))))))))))))); + | |_______________________^ expected `Option>, _>>`, found `Result, _>, _>` | = note: expected enum `Option>>>>>, _>>` found enum `Result, _>, _>` diff --git a/tests/ui/diagnostic-width/long-E0308.unicode.stderr b/tests/ui/diagnostic-width/long-E0308.unicode.stderr index 07c1068f0edac..576a8b071ca41 100644 --- a/tests/ui/diagnostic-width/long-E0308.unicode.stderr +++ b/tests/ui/diagnostic-width/long-E0308.unicode.stderr @@ -6,7 +6,7 @@ LL │ let x: Atype< LL │ │ Btype< LL │ │ Ctype< LL │ │ Atype< - ‡ │ + ┆ ┆ LL │ │ i32 LL │ │ > = Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O… │ │┏━━━━━│━━━┛ @@ -26,13 +26,13 @@ LL │ ┃ )))))))))))))))))))))))))))))); error[E0308]: mismatched types ╭▸ $DIR/long-E0308.rs:58:26 │ -LL │ ))))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(… - │ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛ -LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok… -LL │ ┃ Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) -LL │ ┃ )))))))))))))))))))))))))))))) -LL │ ┃ )))))))))))))))))))))))); - │ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option>, _>>`, found `Result, _>, _>` +LL │ …))))))))))))))) == Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok… + │ ┏━━━━━━━━━━━━━━━━━━━━━┛ +LL │ ┃ … Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(Ok(O… +LL │ ┃ … Ok(Ok(Ok(Ok(Ok(Ok(Ok(""))))))) +LL │ ┃ … )))))))))))))))))))))))))))))) +LL │ ┃ …)))))))))))))))))))))); + │ ┗━━━━━━━━━━━━━━━━━━━━━━━┛ expected `Option>, _>>`, found `Result, _>, _>` │ ├ note: expected enum `Option>>>>>, _>>` │ found enum `Result, _>, _>` @@ -47,7 +47,7 @@ LL │ let x: Atype< LL │ │ Btype< LL │ │ Ctype< LL │ │ Atype< - ‡ │ + ┆ ┆ LL │ │ i32 LL │ │ > = (); │ │ │ ━━ expected `Atype, i32>, i32>`, found `()` diff --git a/tests/ui/error-emitter/E0308-clarification.svg b/tests/ui/error-emitter/E0308-clarification.svg index bf4c5ca2a4760..13ee2fe1a880d 100644 --- a/tests/ui/error-emitter/E0308-clarification.svg +++ b/tests/ui/error-emitter/E0308-clarification.svg @@ -36,7 +36,7 @@ │ the found opaque type - ‡ + ┆ LL │ x = (x.1, x.0); @@ -68,7 +68,7 @@ │ the found opaque type - ‡ + ┆ LL │ x = (x.1, x.0); diff --git a/tests/ui/errors/unknown-target-suggestion.stderr b/tests/ui/errors/unknown-target-suggestion.stderr index 09d4827241520..69ac370c9e4f8 100644 --- a/tests/ui/errors/unknown-target-suggestion.stderr +++ b/tests/ui/errors/unknown-target-suggestion.stderr @@ -1,5 +1,5 @@ error: error loading target specification: could not find specification for target "x86_64-linux-gnu" - | - = help: run `rustc --print target-list` for a list of built-in targets - = help: did you mean `x86_64-unknown-linux-gnu`? + | + = help: run `rustc --print target-list` for a list of built-in targets + = help: did you mean `x86_64-unknown-linux-gnu`? diff --git a/tests/ui/errors/wrong-target-spec.stderr b/tests/ui/errors/wrong-target-spec.stderr index cab485312bfdd..646d0aa68ee45 100644 --- a/tests/ui/errors/wrong-target-spec.stderr +++ b/tests/ui/errors/wrong-target-spec.stderr @@ -1,5 +1,5 @@ error: error loading target specification: could not find specification for target "x86_64_unknown-linux-musl" - | - = help: run `rustc --print target-list` for a list of built-in targets - = help: did you mean `x86_64-unknown-linux-musl`? + | + = help: run `rustc --print target-list` for a list of built-in targets + = help: did you mean `x86_64-unknown-linux-musl`? diff --git a/tests/ui/extern-flag/invalid-crate-name-dashed.stderr b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr index 5da1c4bb20a37..0db4018b245b0 100644 --- a/tests/ui/extern-flag/invalid-crate-name-dashed.stderr +++ b/tests/ui/extern-flag/invalid-crate-name-dashed.stderr @@ -1,4 +1,4 @@ error: crate name `my-awesome-library` passed to `--extern` is not a valid ASCII identifier - | - = help: consider replacing the dashes with underscores: `my_awesome_library` + | + = help: consider replacing the dashes with underscores: `my_awesome_library` diff --git a/tests/ui/print-request/print-lints-help.stderr b/tests/ui/print-request/print-lints-help.stderr index 1f821d12f169d..eec98b0bae63c 100644 --- a/tests/ui/print-request/print-lints-help.stderr +++ b/tests/ui/print-request/print-lints-help.stderr @@ -1,6 +1,6 @@ error: unknown print request: `lints` - | - = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` - = help: use `-Whelp` to print a list of lints - = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information + | + = help: valid print requests are: `all-target-specs-json`, `backend-has-mnemonic`, `backend-has-zstd`, `calling-conventions`, `cfg`, `check-cfg`, `code-models`, `crate-name`, `crate-root-lint-levels`, `deployment-target`, `file-names`, `host-tuple`, `link-args`, `native-static-libs`, `relocation-models`, `split-debuginfo`, `stack-protector-strategies`, `supported-crate-types`, `sysroot`, `target-cpus`, `target-features`, `target-libdir`, `target-list`, `target-spec-json`, `target-spec-json-schema`, `tls-models`, `wasm-proc-macro-tuple` + = help: use `-Whelp` to print a list of lints + = help: for more information, see the rustc book: https://doc.rust-lang.org/rustc/command-line-arguments.html#--print-print-compiler-information diff --git a/tests/ui/resolve/empty-struct-tuple-pat.stderr b/tests/ui/resolve/empty-struct-tuple-pat.stderr index 864bc218c4d90..4820d3075bc67 100644 --- a/tests/ui/resolve/empty-struct-tuple-pat.stderr +++ b/tests/ui/resolve/empty-struct-tuple-pat.stderr @@ -43,7 +43,7 @@ error[E0532]: expected unit struct, unit variant or constant, found tuple varian LL | XE::XEmpty5 => (), | ^^^^^^^^^^^ | - ::: $DIR/auxiliary/empty-struct.rs:5 + ::: $DIR/auxiliary/empty-struct.rs:8:5 | LL | pub enum XE { ... diff --git a/tests/ui/resolve/empty-struct-unit-pat.stderr b/tests/ui/resolve/empty-struct-unit-pat.stderr index 10bc8a33a7dfd..39af54d43272b 100644 --- a/tests/ui/resolve/empty-struct-unit-pat.stderr +++ b/tests/ui/resolve/empty-struct-unit-pat.stderr @@ -124,7 +124,7 @@ error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XE LL | XE::XEmpty4() => (), | ^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/empty-struct.rs:5 + ::: $DIR/auxiliary/empty-struct.rs:7:5 | LL | pub enum XE { LL | XEmpty3 {}, @@ -169,7 +169,7 @@ error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XE LL | XE::XEmpty4(..) => (), | ^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/empty-struct.rs:5 + ::: $DIR/auxiliary/empty-struct.rs:7:5 | LL | pub enum XE { LL | XEmpty3 {}, diff --git a/tests/ui/rustc-env/min-stack-banana.stderr b/tests/ui/rustc-env/min-stack-banana.stderr index d379367ab4f7f..2b2308e7a1043 100644 --- a/tests/ui/rustc-env/min-stack-banana.stderr +++ b/tests/ui/rustc-env/min-stack-banana.stderr @@ -1,4 +1,4 @@ error: `RUST_MIN_STACK` should be a number of bytes, but was "banana" - | - = note: you can also unset `RUST_MIN_STACK` to use the default stack size + | + = note: you can also unset `RUST_MIN_STACK` to use the default stack size From c34bdf9b72ea19e905f788da1578012b22a3933c Mon Sep 17 00:00:00 2001 From: Scott Schafer Date: Fri, 16 Oct 2026 22:35:47 -0600 Subject: [PATCH 2/2] feat: Add support for annotate-snippets's no-graphics output format --- .../src/annotate_snippet_emitter_writer.rs | 5 ++ compiler/rustc_errors/src/emitter.rs | 1 + compiler/rustc_errors/src/json.rs | 1 + compiler/rustc_errors/src/json/tests.rs | 2 +- compiler/rustc_interface/src/tests.rs | 2 +- compiler/rustc_session/src/config.rs | 30 +++++++---- compiler/rustc_session/src/session.rs | 10 ++-- src/librustdoc/core.rs | 5 +- src/librustdoc/doctest.rs | 7 ++- .../error-format-human-no-graphics.rs | 12 +++++ .../error-format-human-no-graphics.stderr | 13 +++++ tests/ui/error-emitter/no-graphics.color.svg | 52 +++++++++++++++++++ .../error-emitter/no-graphics.no-color.stderr | 13 +++++ tests/ui/error-emitter/no-graphics.rs | 15 ++++++ .../no-graphics.terminal-urls.svg | 52 +++++++++++++++++++ 15 files changed, 201 insertions(+), 19 deletions(-) create mode 100644 tests/ui/diagnostic-flags/error-format-human-no-graphics.rs create mode 100644 tests/ui/diagnostic-flags/error-format-human-no-graphics.stderr create mode 100644 tests/ui/error-emitter/no-graphics.color.svg create mode 100644 tests/ui/error-emitter/no-graphics.no-color.stderr create mode 100644 tests/ui/error-emitter/no-graphics.rs create mode 100644 tests/ui/error-emitter/no-graphics.terminal-urls.svg diff --git a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs index d8b6fc9ecc05b..bc1f2389cf55e 100644 --- a/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs +++ b/compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs @@ -45,6 +45,7 @@ pub struct AnnotateSnippetEmitter { track_diagnostics: bool, terminal_url: TerminalUrl, theme: OutputTheme, + no_graphics: bool, } impl Debug for AnnotateSnippetEmitter { @@ -60,6 +61,7 @@ impl Debug for AnnotateSnippetEmitter { track_diagnostics, terminal_url, theme, + no_graphics, } = self; f.debug_struct("AnnotateSnippetEmitter") @@ -73,6 +75,7 @@ impl Debug for AnnotateSnippetEmitter { .field("track_diagnostics", track_diagnostics) .field("terminal_url", terminal_url) .field("theme", theme) + .field("no_graphics", no_graphics) .finish() } } @@ -153,6 +156,7 @@ impl AnnotateSnippetEmitter { track_diagnostics: false, terminal_url: TerminalUrl::No, theme: OutputTheme::Ascii, + no_graphics: false, } } @@ -543,6 +547,7 @@ impl AnnotateSnippetEmitter { .anonymized_snippet_line_numbers(self.ui_testing) .decor_style(decor_style) .short_message(self.short_message) + .no_graphics(self.no_graphics) } fn pre_style_msgs(&self, msgs: &[(DiagMessage, Style)], args: &DiagArgMap) -> String { diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index af412ef525c95..b546a15a90be9 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -33,6 +33,7 @@ use crate::{ /// Describes the way the content of the `rendered` field of the json output is generated #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct HumanReadableErrorType { + pub no_graphics: bool, pub short: bool, pub unicode: bool, } diff --git a/compiler/rustc_errors/src/json.rs b/compiler/rustc_errors/src/json.rs index 59d79754314c1..2c70a2aa91cde 100644 --- a/compiler/rustc_errors/src/json.rs +++ b/compiler/rustc_errors/src/json.rs @@ -362,6 +362,7 @@ impl Diagnostic { .ui_testing(je.ui_testing) .ignored_directories_in_source_blocks(je.ignored_directories_in_source_blocks.clone()) .theme(if je.json_rendered.unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) + .no_graphics(je.json_rendered.no_graphics) .emit_diagnostic(diag); let buf = Arc::try_unwrap(buf.0).unwrap().into_inner().unwrap(); diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs index 71b66f2e0223b..9522f8ebbfd86 100644 --- a/compiler/rustc_errors/src/json/tests.rs +++ b/compiler/rustc_errors/src/json/tests.rs @@ -51,7 +51,7 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) { Box::new(Shared { data: output.clone() }), Some(sm), true, // pretty - HumanReadableErrorType { short: true, unicode: false }, + HumanReadableErrorType { no_graphics: false, short: true, unicode: false }, ColorConfig::Never, ); diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index fd54da09bdca6..2ad8b9d50762e 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -346,7 +346,7 @@ fn test_search_paths_tracking_hash_different_order() { let early_dcx = EarlyDiagCtxt::new(JSON); const JSON: ErrorOutputType = ErrorOutputType::Json { pretty: false, - json_rendered: HumanReadableErrorType { short: false, unicode: false }, + json_rendered: HumanReadableErrorType { no_graphics: false, short: false, unicode: false }, color_config: ColorConfig::Never, }; diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 2665cb92fc8d0..84295c50d9d93 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -887,7 +887,7 @@ pub enum ErrorOutputType { /// Output meant for the consumption of humans. #[default] HumanReadable { - kind: HumanReadableErrorType = HumanReadableErrorType { short: false, unicode: false }, + kind: HumanReadableErrorType = HumanReadableErrorType { no_graphics: false, short: false, unicode: false }, color_config: ColorConfig = ColorConfig::Auto, }, /// Output that's consumed by other tools such as `rustfix` or the `RLS`. @@ -2337,7 +2337,8 @@ impl JsonUnusedExterns { /// The first value returned is how to render JSON diagnostics, and the second /// is whether or not artifact notifications are enabled. pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> JsonConfig { - let mut json_rendered = HumanReadableErrorType { short: false, unicode: false }; + let mut json_rendered = + HumanReadableErrorType { no_graphics: false, short: false, unicode: false }; let mut json_color = ColorConfig::Never; let mut json_artifact_notifications = false; let mut json_unused_externs = JsonUnusedExterns::No; @@ -2354,10 +2355,16 @@ pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Json for sub_option in option.split(',') { match sub_option { "diagnostic-short" => { - json_rendered = HumanReadableErrorType { short: true, unicode: false }; + json_rendered = + HumanReadableErrorType { no_graphics: false, short: true, unicode: false }; + } + "diagnostic-no-graphics" => { + json_rendered = + HumanReadableErrorType { no_graphics: true, short: false, unicode: false }; } "diagnostic-unicode" => { - json_rendered = HumanReadableErrorType { short: false, unicode: true }; + json_rendered = + HumanReadableErrorType { no_graphics: false, short: false, unicode: true }; } "diagnostic-rendered-ansi" => json_color = ColorConfig::Always, "artifacts" => json_artifact_notifications = true, @@ -2388,7 +2395,7 @@ pub fn parse_error_format( json_color: ColorConfig, json_rendered: HumanReadableErrorType, ) -> ErrorOutputType { - let default_kind = HumanReadableErrorType { short: false, unicode: false }; + let default_kind = HumanReadableErrorType { no_graphics: false, short: false, unicode: false }; // We need the `opts_present` check because the driver will send us Matches // with only stable options if no unstable options are used. Since error-format // is unstable, it will not be present. We have to use `opts_present` not @@ -2405,11 +2412,15 @@ pub fn parse_error_format( ErrorOutputType::Json { pretty: true, json_rendered, color_config: json_color } } Some("short") => ErrorOutputType::HumanReadable { - kind: HumanReadableErrorType { short: true, unicode: false }, + kind: HumanReadableErrorType { no_graphics: false, short: true, unicode: false }, + color_config, + }, + Some("human-no-graphics") => ErrorOutputType::HumanReadable { + kind: HumanReadableErrorType { no_graphics: true, short: false, unicode: false }, color_config, }, Some("human-unicode") => ErrorOutputType::HumanReadable { - kind: HumanReadableErrorType { short: false, unicode: true }, + kind: HumanReadableErrorType { no_graphics: false, short: false, unicode: true }, color_config, }, Some(arg) => { @@ -2418,8 +2429,8 @@ pub fn parse_error_format( kind: default_kind, }); early_dcx.early_fatal(format!( - "argument for `--error-format` must be `human`, `human-unicode`, \ - `json`, `pretty-json` or `short` (instead was `{arg}`)" + "argument for `--error-format` must be `human`, `human-no-graphics`, \ + `human-unicode`, `json`, `pretty-json` or `short` (instead was `{arg}`)" )) } } @@ -2494,6 +2505,7 @@ fn check_error_format_stability( let format = match format { ErrorOutputType::Json { pretty: true, .. } => "pretty-json", ErrorOutputType::HumanReadable { kind, .. } => match kind { + HumanReadableErrorType { no_graphics: true, .. } => "human-no-graphics", HumanReadableErrorType { unicode: true, .. } => "human-unicode", _ => return, }, diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 9bf2de0466233..f829877d95857 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1310,7 +1310,7 @@ fn default_emitter(sopts: &config::Options, source_map: Arc) -> Box match kind { - HumanReadableErrorType { short, unicode } => { + HumanReadableErrorType { no_graphics, short, unicode } => { let emitter = AnnotateSnippetEmitter::new(stderr_destination(color_config)) .sm(source_map) .short_message(short) @@ -1321,7 +1321,8 @@ fn default_emitter(sopts: &config::Options, source_map: Arc) -> Box Box { let emitter: Box = match output { config::ErrorOutputType::HumanReadable { kind, color_config } => match kind { - HumanReadableErrorType { short, unicode } => Box::new( + HumanReadableErrorType { no_graphics, short, unicode } => Box::new( AnnotateSnippetEmitter::new(stderr_destination(color_config)) .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) - .short_message(short), + .short_message(short) + .no_graphics(no_graphics), ), }, config::ErrorOutputType::Json { pretty, json_rendered, color_config } => { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 0c3995f1d3620..94277ec5815ab 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -172,14 +172,15 @@ pub(crate) fn new_dcx( ) -> rustc_errors::DiagCtxt { let emitter: Box = match error_format { ErrorOutputType::HumanReadable { kind, color_config } => match kind { - HumanReadableErrorType { short, unicode } => Box::new( + HumanReadableErrorType { no_graphics, short, unicode } => Box::new( AnnotateSnippetEmitter::new(stderr_destination(color_config)) .sm(source_map.map(|sm| sm as _)) .short_message(short) .diagnostic_width(diagnostic_width) .track_diagnostics(unstable_opts.track_diagnostics) .theme(if unicode { OutputTheme::Unicode } else { OutputTheme::Ascii }) - .ui_testing(unstable_opts.ui_testing), + .ui_testing(unstable_opts.ui_testing) + .no_graphics(no_graphics), ), }, ErrorOutputType::Json { pretty, json_rendered, color_config } => { diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index ce8505dfdc811..0c0e2cddf6826 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -648,9 +648,12 @@ fn run_test( }, ]); if let ErrorOutputType::HumanReadable { kind, color_config } = rustdoc_options.error_format { - let short = kind.short(); - let unicode = kind == HumanReadableErrorType { unicode: true, short }; + let HumanReadableErrorType { no_graphics, short, unicode } = kind; + if no_graphics { + compiler_args + .extend_from_slice(&["--error-format".to_owned(), "human-no-graphics".to_owned()]); + } if short { compiler_args.extend_from_slice(&["--error-format".to_owned(), "short".to_owned()]); } diff --git a/tests/ui/diagnostic-flags/error-format-human-no-graphics.rs b/tests/ui/diagnostic-flags/error-format-human-no-graphics.rs new file mode 100644 index 0000000000000..f0c7b767df9d9 --- /dev/null +++ b/tests/ui/diagnostic-flags/error-format-human-no-graphics.rs @@ -0,0 +1,12 @@ +//! Check that compile errors are formatted in the "no-graphics" style +//! when `--error-format=human-no-graphics` is used. + +//@ compile-flags: --error-format=human-no-graphics + +fn foo(_: u32) {} + +fn main() { + foo("Bonjour".to_owned()); + let x = 0u32; + x.salut(); +} diff --git a/tests/ui/diagnostic-flags/error-format-human-no-graphics.stderr b/tests/ui/diagnostic-flags/error-format-human-no-graphics.stderr new file mode 100644 index 0000000000000..2b5cdc2edb64e --- /dev/null +++ b/tests/ui/diagnostic-flags/error-format-human-no-graphics.stderr @@ -0,0 +1,13 @@ +error E0308: mismatched types + at $DIR/error-format-human-no-graphics.rs:9:9: expected `u32`, found `String` + on line 9: arguments to this function are incorrect +note: function defined here + at $DIR/error-format-human-no-graphics.rs:6:4 + +error E0599: no method named `salut` found for type `u32` in the current scope + at $DIR/error-format-human-no-graphics.rs:11:7: method not found in `u32` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/error-emitter/no-graphics.color.svg b/tests/ui/error-emitter/no-graphics.color.svg new file mode 100644 index 0000000000000..d61b2d8786480 --- /dev/null +++ b/tests/ui/error-emitter/no-graphics.color.svg @@ -0,0 +1,52 @@ + + + + + + + error E0308: mismatched types + + at $DIR/no-graphics.rs:12:9: expected `u32`, found `String` + + on line 12: arguments to this function are incorrect + + note: function defined here + + at $DIR/no-graphics.rs:9:4 + + + + error E0599: no method named `salut` found for type `u32` in the current scope + + at $DIR/no-graphics.rs:14:7: method not found in `u32` + + + + error: aborting due to 2 previous errors + + + + Some errors have detailed explanations: E0308, E0599. + + For more information about an error, try `rustc --explain E0308`. + + + + + + diff --git a/tests/ui/error-emitter/no-graphics.no-color.stderr b/tests/ui/error-emitter/no-graphics.no-color.stderr new file mode 100644 index 0000000000000..62a26265381a0 --- /dev/null +++ b/tests/ui/error-emitter/no-graphics.no-color.stderr @@ -0,0 +1,13 @@ +error E0308: mismatched types + at $DIR/no-graphics.rs:12:9: expected `u32`, found `String` + on line 12: arguments to this function are incorrect +note: function defined here + at $DIR/no-graphics.rs:9:4 + +error E0599: no method named `salut` found for type `u32` in the current scope + at $DIR/no-graphics.rs:14:7: method not found in `u32` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/error-emitter/no-graphics.rs b/tests/ui/error-emitter/no-graphics.rs new file mode 100644 index 0000000000000..9348b098d8979 --- /dev/null +++ b/tests/ui/error-emitter/no-graphics.rs @@ -0,0 +1,15 @@ +//! Check that compile errors are formatted in the "no-graphics" style +//! when `--error-format=human-no-graphics` is used. + +//@ revisions: color no-color terminal-urls +//@[color] compile-flags: --error-format=human-no-graphics --color=always +//@[no-color] compile-flags: --error-format=human-no-graphics --color=never +//@[terminal-urls] compile-flags: --error-format=human-no-graphics --color=always -Zterminal-urls=yes + +fn foo(_: u32) {} + +fn main() { + foo("Bonjour".to_owned()); + let x = 0u32; + x.salut(); +} diff --git a/tests/ui/error-emitter/no-graphics.terminal-urls.svg b/tests/ui/error-emitter/no-graphics.terminal-urls.svg new file mode 100644 index 0000000000000..befddcfe84f73 --- /dev/null +++ b/tests/ui/error-emitter/no-graphics.terminal-urls.svg @@ -0,0 +1,52 @@ + + + + + + + error E0308: mismatched types + + at $DIR/no-graphics.rs:12:9: expected `u32`, found `String` + + on line 12: arguments to this function are incorrect + + note: function defined here + + at $DIR/no-graphics.rs:9:4 + + + + error E0599: no method named `salut` found for type `u32` in the current scope + + at $DIR/no-graphics.rs:14:7: method not found in `u32` + + + + error: aborting due to 2 previous errors + + + + Some errors have detailed explanations: E0308, E0599. + + For more information about an error, try `rustc --explain E0308`. + + + + + +