Skip to content

Commit 3f1e8cc

Browse files
authored
Rollup merge of #147165 - Muscraft:subtract-code-offset, r=davidtwco
test: Subtract code_offset from width for ui_testing `annotate-snippets` does not have a "UI test" mode like `rustc`, [where the code offset is not subtracted from the column width](https://github.com/rust-lang/rust/blob/f34ba774c78ea32b7c40598b8ad23e75cdac42a6/compiler/rustc_errors/src/emitter.rs#L1985-L1987). This makes it so `annotate-snippets` will shift the output for some very long tests 5 - 7 columns to the left. As part of my work to have `rustc` use `annotate-snippets`, and to reduce the test differences between the two, I figured it would be best if `rustc` started subtracting the code offset from the width as well. The first commit exists to keep the test output changes of adding a new line to a test separate from adding the `--diagnostic-width` flag in the second commit. This makes it easier to verify that adding the flag does not affect the test's output. [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/annotate-snippets.20hurdles)
2 parents 843f4d8 + 6d06db5 commit 3f1e8cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/ui/option_env_unwrap.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ LL | let _ = option_env!("PATH").expect("environment variable PATH isn't set
1919
error: this will panic at run-time if the environment variable doesn't exist at compile-time
2020
--> tests/ui/option_env_unwrap.rs:14:13
2121
|
22-
LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only works if you don't have a __Y__do_not_use env variable in your env...
22+
LL | let _ = option_env!("__Y__do_not_use").unwrap(); // This test only works if you don't have a __Y__do_not_use env variable in you...
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424
|
2525
= help: consider using the `env!` macro instead

tests/ui/too_long_first_doc_paragraph.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ LL | | /// gravida non lacinia at, rhoncus eu lacus.
4242
error: first doc comment paragraph is too long
4343
--> tests/ui/too_long_first_doc_paragraph.rs:65:1
4444
|
45-
LL | / /// Some function. This doc-string paragraph is too long. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lore...
45+
LL | / /// Some function. This doc-string paragraph is too long. Lorem Ipsum is simply dummy text of the printing and typesetting industr...
4646
LL | |
4747
LL | | ///
4848
LL | | /// Here's a second paragraph. It would be preferable to put the details here.

0 commit comments

Comments
 (0)