about summary refs log tree commit diff
path: root/tests/ui/error-codes
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/error-codes
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/error-codes')
-rw-r--r--tests/ui/error-codes/E0271.rs1
-rw-r--r--tests/ui/error-codes/E0271.stderr6
-rw-r--r--tests/ui/error-codes/E0275.rs1
-rw-r--r--tests/ui/error-codes/E0275.stderr4
4 files changed, 7 insertions, 5 deletions
diff --git a/tests/ui/error-codes/E0271.rs b/tests/ui/error-codes/E0271.rs
index f2719075434..ec6b8b5532e 100644
--- a/tests/ui/error-codes/E0271.rs
+++ b/tests/ui/error-codes/E0271.rs
@@ -1,3 +1,4 @@
+// compile-flags: -Zwrite-long-types-to-disk=yes
 trait Trait { type AssociatedType; }
 
 fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
diff --git a/tests/ui/error-codes/E0271.stderr b/tests/ui/error-codes/E0271.stderr
index 1e2f4383459..98b5aa83da6 100644
--- a/tests/ui/error-codes/E0271.stderr
+++ b/tests/ui/error-codes/E0271.stderr
@@ -1,5 +1,5 @@
 error[E0271]: type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
-  --> $DIR/E0271.rs:10:9
+  --> $DIR/E0271.rs:11:9
    |
 LL |     foo(3_i8);
    |     --- ^^^^ type mismatch resolving `<i8 as Trait>::AssociatedType == u32`
@@ -7,12 +7,12 @@ LL |     foo(3_i8);
    |     required by a bound introduced by this call
    |
 note: expected this to be `u32`
-  --> $DIR/E0271.rs:7:43
+  --> $DIR/E0271.rs:8:43
    |
 LL | impl Trait for i8 { type AssociatedType = &'static str; }
    |                                           ^^^^^^^^^^^^
 note: required by a bound in `foo`
-  --> $DIR/E0271.rs:3:32
+  --> $DIR/E0271.rs:4:32
    |
 LL | fn foo<T>(t: T) where T: Trait<AssociatedType=u32> {
    |                                ^^^^^^^^^^^^^^^^^^ required by this bound in `foo`
diff --git a/tests/ui/error-codes/E0275.rs b/tests/ui/error-codes/E0275.rs
index 95d7f85f105..5119544e29f 100644
--- a/tests/ui/error-codes/E0275.rs
+++ b/tests/ui/error-codes/E0275.rs
@@ -1,3 +1,4 @@
+// compile-flags: -Zwrite-long-types-to-disk=yes
 // normalize-stderr-test: "long-type-\d+" -> "long-type-hash"
 trait Foo {}
 
diff --git a/tests/ui/error-codes/E0275.stderr b/tests/ui/error-codes/E0275.stderr
index 03c37d6f0e1..1ddb058d0fd 100644
--- a/tests/ui/error-codes/E0275.stderr
+++ b/tests/ui/error-codes/E0275.stderr
@@ -1,12 +1,12 @@
 error[E0275]: overflow evaluating the requirement `Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>: Foo`
-  --> $DIR/E0275.rs:6:33
+  --> $DIR/E0275.rs:7:33
    |
 LL | impl<T> Foo for T where Bar<T>: Foo {}
    |                                 ^^^
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`E0275`)
 note: required for `Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<Bar<...>>>>>>>>>>>>>>>>>>>>>` to implement `Foo`
-  --> $DIR/E0275.rs:6:9
+  --> $DIR/E0275.rs:7:9
    |
 LL | impl<T> Foo for T where Bar<T>: Foo {}
    |         ^^^     ^               --- unsatisfied trait bound introduced here