diff --git a/src/doc/rustc-dev-guide/src/tests/ui.md b/src/doc/rustc-dev-guide/src/tests/ui.md index 759029e671322..e13419d1e01cc 100644 --- a/src/doc/rustc-dev-guide/src/tests/ui.md +++ b/src/doc/rustc-dev-guide/src/tests/ui.md @@ -139,6 +139,10 @@ prefixing each source line are replaced with `LL`). In extremely rare situations, this mode can be disabled with the directive `//@ compile-flags: -Z ui-testing=no`. +When using `-Z ui-testing=no` the `--diagnostic-width` argument should also +be set to avoid tests failing or passing depending on the width of the terminal +from which the UI test suite is being run. + Note: The line and column numbers for `-->` lines pointing to the test are *not* normalized, and left as-is. This ensures that the compiler continues to point to the correct location, and keeps the stderr files readable. Ideally all diff --git a/tests/ui/compiletest-self-test/ui-testing-optout.rs b/tests/ui/compiletest-self-test/ui-testing-optout.rs index 62920a86c3b3e..2f2bc54676a8d 100644 --- a/tests/ui/compiletest-self-test/ui-testing-optout.rs +++ b/tests/ui/compiletest-self-test/ui-testing-optout.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z ui-testing=no +//@ compile-flags: -Z ui-testing=no --diagnostic-width=80 // Line number < 10 type A = B; //~ ERROR diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs index 09a11c75fd7bd..b679493eb08eb 100644 --- a/tests/ui/consts/missing_span_in_backtrace.rs +++ b/tests/ui/consts/missing_span_in_backtrace.rs @@ -1,6 +1,6 @@ //! Check what happens when the error occurs inside a std function that we can't print the span of. //@ ignore-backends: gcc -//@ compile-flags: -Z ui-testing=no +//@ compile-flags: -Z ui-testing=no --diagnostic-width=80 use std::{ mem::{self, MaybeUninit}, diff --git a/tests/ui/consts/missing_span_in_backtrace.stderr b/tests/ui/consts/missing_span_in_backtrace.stderr index 55dde63582861..b86911e7057b2 100644 --- a/tests/ui/consts/missing_span_in_backtrace.stderr +++ b/tests/ui/consts/missing_span_in_backtrace.stderr @@ -1,12 +1,12 @@ 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 --> $DIR/missing_span_in_backtrace.rs:16:9 | -16 | / ptr::swap_nonoverlapping( -17 | | &mut x1 as *mut _ as *mut MaybeUninit, -18 | | &mut x2 as *mut _ as *mut MaybeUninit, -19 | | 10, -20 | | ); - | |_________^ evaluation of `X` failed inside this call +16 | / ... ptr::swap_nonoverlapping( +17 | | ... &mut x1 as *mut _ as *mut MaybeUninit, +18 | | ... &mut x2 as *mut _ as *mut MaybeUninit, +19 | | ... 10, +20 | | ... ); + | |_______^ evaluation of `X` failed inside this call | note: inside `swap_nonoverlapping::compiletime::>` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL diff --git a/tests/ui/error-emitter/trimmed_multiline_suggestion.rs b/tests/ui/error-emitter/trimmed_multiline_suggestion.rs index c0ae9af4e9b25..7100a96611c6f 100644 --- a/tests/ui/error-emitter/trimmed_multiline_suggestion.rs +++ b/tests/ui/error-emitter/trimmed_multiline_suggestion.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z ui-testing=no +//@ compile-flags: -Z ui-testing=no --diagnostic-width=80 fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {} fn main() { diff --git a/tests/ui/error-emitter/trimmed_multiline_suggestion.stderr b/tests/ui/error-emitter/trimmed_multiline_suggestion.stderr index 6e1ffb153bc2b..d593647a5ba07 100644 --- a/tests/ui/error-emitter/trimmed_multiline_suggestion.stderr +++ b/tests/ui/error-emitter/trimmed_multiline_suggestion.stderr @@ -10,7 +10,7 @@ error[E0061]: this function takes 6 arguments but 5 arguments were supplied note: function defined here --> $DIR/trimmed_multiline_suggestion.rs:2:4 | -2 | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i32, f: i32) {} +2 | fn function_with_lots_of_arguments(a: i32, b: char, c: i32, d: i32, e: i3... | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------- help: provide the argument | diff --git a/tests/ui/modules/issue-107649.rs b/tests/ui/modules/issue-107649.rs index f93fb07e17af0..731c2c0592a18 100644 --- a/tests/ui/modules/issue-107649.rs +++ b/tests/ui/modules/issue-107649.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z ui-testing=no +//@ compile-flags: -Z ui-testing=no --diagnostic-width=80 #[path = "auxiliary/dummy_lib.rs"] mod lib; diff --git a/tests/ui/span/issue-71363.rs b/tests/ui/span/issue-71363.rs index f186e0526a424..4ce8a942c7b1b 100644 --- a/tests/ui/span/issue-71363.rs +++ b/tests/ui/span/issue-71363.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z ui-testing=no +//@ compile-flags: -Z ui-testing=no --diagnostic-width=80 struct MyError; impl std::error::Error for MyError {}