Skip to content

Commit 8221b5e

Browse files
authored
Rollup merge of #151375 - terminal_width_independence, r=lqd
Fix terminal width dependent tests [#t-compiler > What is -Zui-testing=no and why are we using it](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/What.20is.20-Zui-testing.3Dno.20and.20why.20are.20we.20using.20it/with/568842970) See zulip thread. I've verified locally that this lets me run the ui test suite without problems even with a very thin terminal 😆
2 parents 0a5d1e8 + 8a57358 commit 8221b5e

8 files changed

Lines changed: 16 additions & 12 deletions

File tree

src/doc/rustc-dev-guide/src/tests/ui.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ prefixing each source line are replaced with `LL`). In extremely rare
139139
situations, this mode can be disabled with the directive `//@
140140
compile-flags: -Z ui-testing=no`.
141141

142+
When using `-Z ui-testing=no` the `--diagnostic-width` argument should also
143+
be set to avoid tests failing or passing depending on the width of the terminal
144+
from which the UI test suite is being run.
145+
142146
Note: The line and column numbers for `-->` lines pointing to the test are *not*
143147
normalized, and left as-is. This ensures that the compiler continues to point to
144148
the correct location, and keeps the stderr files readable. Ideally all

tests/ui/compiletest-self-test/ui-testing-optout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z ui-testing=no
1+
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
22

33
// Line number < 10
44
type A = B; //~ ERROR

tests/ui/consts/missing_span_in_backtrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Check what happens when the error occurs inside a std function that we can't print the span of.
22
//@ ignore-backends: gcc
3-
//@ compile-flags: -Z ui-testing=no
3+
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
44

55
use std::{
66
mem::{self, MaybeUninit},

tests/ui/consts/missing_span_in_backtrace.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0080]: memory access failed: attempting to access 1 byte, but got ALLOC0+0x4 which is at or beyond the end of the allocation of size 4 bytes
22
--> $DIR/missing_span_in_backtrace.rs:16:9
33
|
4-
16 | / ptr::swap_nonoverlapping(
5-
17 | | &mut x1 as *mut _ as *mut MaybeUninit<u8>,
6-
18 | | &mut x2 as *mut _ as *mut MaybeUninit<u8>,
7-
19 | | 10,
8-
20 | | );
9-
| |_________^ evaluation of `X` failed inside this call
4+
16 | / ... ptr::swap_nonoverlapping(
5+
17 | | ... &mut x1 as *mut _ as *mut MaybeUninit<u8>,
6+
18 | | ... &mut x2 as *mut _ as *mut MaybeUninit<u8>,
7+
19 | | ... 10,
8+
20 | | ... );
9+
| |_______^ evaluation of `X` failed inside this call
1010
|
1111
note: inside `swap_nonoverlapping::compiletime::<MaybeUninit<u8>>`
1212
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL

tests/ui/error-emitter/trimmed_multiline_suggestion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z ui-testing=no
1+
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
22
fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {}
33

44
fn main() {

tests/ui/error-emitter/trimmed_multiline_suggestion.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ error[E0061]: this function takes 6 arguments but 5 arguments were supplied
1010
note: function defined here
1111
--> $DIR/trimmed_multiline_suggestion.rs:2:4
1212
|
13-
2 | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {}
13+
2 | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i3...
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -------
1515
help: provide the argument
1616
|

tests/ui/modules/issue-107649.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z ui-testing=no
1+
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
22
#[path = "auxiliary/dummy_lib.rs"]
33
mod lib;
44

tests/ui/span/issue-71363.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ compile-flags: -Z ui-testing=no
1+
//@ compile-flags: -Z ui-testing=no --diagnostic-width=80
22

33
struct MyError;
44
impl std::error::Error for MyError {}

0 commit comments

Comments
 (0)