-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API/config to pass --verbose to avoid name shortening #269
Comments
I was able to reproduce this using this test case: use std::marker::PhantomData as P;
fn f(_: ()) {}
fn main() {
let p: (P<P<P<P<P<P<P<P<()>>>>>>>>, _) = (P, || {});
f(p);
} When running ui tests from a directory that has a relatively short filepath, the normalized stderr is: error[E0308]: mismatched types
--> tests/ui/long-type-name.rs:7:7
|
6 | let p: (P<P<P<P<P<P<P<P<()>>>>>>>>, _) = (P, || {});
| -- the found closure
7 | f(p);
| - ^ expected `()`, found `(PhantomData<...>, ...)`
| |
| arguments to this function are incorrect
|
= note: expected unit type `()`
found tuple `(PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<()>>>>>>>>, {closure@$DIR/tests/ui/long-type-name.rs:6:50: 6:52})`
note: function defined here
--> tests/ui/long-type-name.rs:3:4
|
3 | fn f(_: ()) {}
| ^ ----- In a longer filepath, the same test produces: error[E0308]: mismatched types
--> tests/ui/long-type-name.rs:7:7
|
6 | let p: (P<P<P<P<P<P<P<P<()>>>>>>>>, _) = (P, || {});
| -- the found closure
7 | f(p);
| - ^ expected `()`, found `(PhantomData<...>, ...)`
| |
| arguments to this function are incorrect
|
= note: expected unit type `()`
found tuple `(PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<PhantomData<...>>>>>>>, ...)`
= note: consider using `--verbose` to print the full type name to the console
note: function defined here
--> tests/ui/long-type-name.rs:3:4
|
3 | fn f(_: ()) {}
| ^ ----- I think it would be fine for trybuild to pass |
This was referenced Jul 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I observe that in some scenarios, my trybuild tests are triggering the Rust long type name shortening logic. This is inconsistent between usages: in some situations my trybuild tests trigger this shortening, in others not. Perhaps due to filesystem paths or whatnot differences? Hard to say. Anyway, this changes the stderr output, so causes inconsistent test results.
Example of this happening to others: rust-lang/rust#113424
This is not desirable, so I am looking for a way to disable this behavior in all my trybuild tests (running in stable toolchain). As per rust-lang/rust#119130 it seems that passing
--verbose
can be used to disable this logic, which seems suitable (though I wonder what else it does).I would like to pass this flag in all my trybuild tests. Today, no feature for this appears to exist - I request such a feature (in a form that would not require me to apply it globally in env variables).
The text was updated successfully, but these errors were encountered: