about summary refs log tree commit diff
path: root/tests/ui/diagnostic-width
diff options
context:
space:
mode:
authorMahdi Dibaiee <mdibaiee@pm.me>2023-07-20 16:47:42 +0100
committerMahdi Dibaiee <mdibaiee@pm.me>2023-07-24 12:25:05 +0100
commit8df39667dcc802a152ca0fe0b85e51a7b6788b82 (patch)
tree88202e8e65cdd40e7d483b904d99a9476be3e1bc /tests/ui/diagnostic-width
parent33a2c2487ac5d9927830ea4c1844335c6b9f77db (diff)
downloadrust-8df39667dcc802a152ca0fe0b85e51a7b6788b82.tar.gz
rust-8df39667dcc802a152ca0fe0b85e51a7b6788b82.zip
new unstable option: -Zwrite-long-types-to-disk
This option guards the logic of writing long type names in files and
instead using short forms in error messages in rustc_middle/ty/error
behind a flag. The main motivation for this change is to disable this
behaviour when running ui tests.

This logic can be triggered by running tests in a directory that has a
long enough path, e.g. /my/very-long-path/where/rust-codebase/exists/

This means ui tests can fail depending on how long the path to their
file is.

Some ui tests actually rely on this behaviour for their assertions,
so for those we enable the flag manually.
Diffstat (limited to 'tests/ui/diagnostic-width')
-rw-r--r--tests/ui/diagnostic-width/E0271.stderr3
-rw-r--r--tests/ui/diagnostic-width/long-E0308.rs2
2 files changed, 2 insertions, 3 deletions
diff --git a/tests/ui/diagnostic-width/E0271.stderr b/tests/ui/diagnostic-width/E0271.stderr
index 52f415037d3..c1b8b32071c 100644
--- a/tests/ui/diagnostic-width/E0271.stderr
+++ b/tests/ui/diagnostic-width/E0271.stderr
@@ -15,8 +15,7 @@ note: expected this to be `Foo`
    |
 LL |     type Error = E;
    |                  ^
-   = note: required for the cast from `Box<Result<..., ...>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
-   = note: the full name for the source type has been written to '$TEST_BUILD_DIR/diagnostic-width/E0271/E0271.long-type-hash.txt'
+   = note: required for the cast from `Box<Result<Result<(), Result<Result<(), Result<Result<(), Option<{integer}>>, ()>>, ()>>, ()>>` to `Box<(dyn Future<Error = Foo> + 'static)>`
 
 error: aborting due to previous error
 
diff --git a/tests/ui/diagnostic-width/long-E0308.rs b/tests/ui/diagnostic-width/long-E0308.rs
index f021f102933..0ae5e19ab2a 100644
--- a/tests/ui/diagnostic-width/long-E0308.rs
+++ b/tests/ui/diagnostic-width/long-E0308.rs
@@ -1,4 +1,4 @@
-// compile-flags: --diagnostic-width=60
+// compile-flags: --diagnostic-width=60 -Zwrite-long-types-to-disk=yes
 // normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
 
 mod a {