rust/tests/ui/coercion
Guillaume Gomez 0d9a57d979
Rollup merge of #133470 - jieyouxu:ugly, r=compiler-errors
Cleanup: delete `//@ pretty-expanded` directive

This PR removes the `//@ pretty-expanded` directive support in compiletest and removes its usage inside ui tests because it does not actually do anything, and its existence is itself misleading. This PR is split into two commits:

1. The first commit just drops `pretty-expanded` directive support in compiletest.
2. The second commit is created by `sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs`[^1], reblessing, and slightly adjusting some leading whitespace in a few tests.

We can tell this is fully removed because compiletest doesn't complain about unknown directive when running the `ui` test suite.

cc #23616

### History

Originally, there was some effort to introduce more test coverage for `-Z unpretty=expanded` (in 2015 this was called `--pretty=expanded`). In [Make it an error to not declare used features #23598][pr-23598], there was a flip from `//@ no-pretty-expanded` (opt-out of `-Z
unpretty=expanded` test) to `//@ pretty-expanded` (opt-in to `-Z unpretty=expanded` test). This was needed because back then the dedicated `tests/pretty` ("pretty") test suite did not existed, and the pretty tests were grouped together under `run-pass` tests (I believe the `ui` test suite didn't exist back then either). Unfortunately, in this process the replacement `//@ pretty-expanded` directives contained a `FIXME #23616` linking to [There are very few tests for `-Z unpretty` expansion #23616][issue-23616]. But this was arguably backwards and somewhat misleading, as noted in [#23616](https://github.com/rust-lang/rust/issues/23616#issuecomment-484999901):

    The attribute is off by default and things just work if you don't
    test it, people have not been adding the `pretty-expanded`
    annotation to new tests even if it would work.

Which basically renders this useless.

### Current status

As of Nov 2024, we have a dedicated `pretty` test suite, and some time over the years the split between `run-pass` into `ui` and `pretty` test suites caused all the `//@ pretty-expanded` in `ui` tests to do absolutely nothing: the compiletest logic for `pretty-expanded` only triggers in the *pretty* test suite, but none of the pretty tests use it. Oops.

Nobody remembers this, nobody uses this, it's misleading in ui tests. Let's get rid of this directive altogether.

[pr-23598]: https://github.com/rust-lang/rust/pull/23598
[issue-23616]: https://github.com/rust-lang/rust/issues/23616

### Follow-ups

- [x] Yeet this directive from rustc-dev-guide docs. https://github.com/rust-lang/rustc-dev-guide/pull/2147

[^1]: https://github.com/chmln/sd

r? compiler
2024-11-26 15:32:18 +01:00
..
auxiliary Move /src/test to /tests 2023-01-11 09:32:08 +00:00
cast-higher-ranked-unsafe-fn-ptr.rs Use subtyping for UnsafeFnPointer coercion, too 2024-08-19 21:26:10 -04:00
coerce-block-tail-26978.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail-26978.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-block-tail-57749.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail-57749.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-block-tail-83783.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail-83783.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail-83783.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-block-tail-83850.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail-83850.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-block-tail.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-block-tail.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-expect-unsized-ascribed.rs Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
coerce-expect-unsized-ascribed.stderr diagnostics: Box<dyn Trait> suggestion with multiple matching impl 2024-08-06 18:24:17 -07:00
coerce-expect-unsized.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-issue-49593-box-never.nofallback.stderr Remove windows-specific copy of test 2024-06-17 10:57:52 +00:00
coerce-issue-49593-box-never.rs Relate receiver invariantly in method probe for Mode::Path 2024-09-16 10:55:07 -04:00
coerce-loop-issue-122561.rs Remove note about iteration count in coerce 2024-04-30 12:46:59 +05:30
coerce-loop-issue-122561.stderr Remove note about iteration count in coerce 2024-04-30 12:46:59 +05:30
coerce-mut.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-mut.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
coerce-overloaded-autoderef-fail.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-overloaded-autoderef-fail.stderr Tweak E0597 2023-01-15 19:46:20 +00:00
coerce-overloaded-autoderef.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-reborrow-imm-ptr-arg.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-reborrow-imm-ptr-rcvr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-reborrow-imm-vec-arg.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-reborrow-imm-vec-rcvr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-reborrow-multi-arg-fail.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-reborrow-multi-arg-fail.stderr Tweak parameter mismatch explanation to not say unknown 2024-11-25 03:04:07 +00:00
coerce-reborrow-multi-arg.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-reborrow-mut-ptr-arg.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-reborrow-mut-ptr-rcvr.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-reborrow-mut-vec-arg.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-reborrow-mut-vec-rcvr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-to-bang-cast.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-to-bang-cast.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-to-bang.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coerce-to-bang.stderr Refactored a few bits: 2024-03-15 13:37:41 +00:00
coerce-unify-return.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coerce-unify.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coerce-unsize-subtype.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
coercion-missing-tail-expected-type.fixed [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coercion-missing-tail-expected-type.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
coercion-missing-tail-expected-type.stderr Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
coercion-slice.rs Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
coercion-slice.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
constrain-expectation-in-arg.rs Inline expected_inputs_for_expected_output into check_argument_types/check_expr_struct_fields 2024-08-31 16:08:29 -04:00
issue-3794.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-14589.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-14589.stderr tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-26905-rpass.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-26905.rs Move some tests 2024-02-09 15:43:08 -03:00
issue-26905.stderr Move some tests 2024-02-09 15:43:08 -03:00
issue-32122-1.fixed Move some tests 2024-04-21 15:43:43 -03:00
issue-32122-1.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-32122-1.stderr Move some tests 2024-04-21 15:43:43 -03:00
issue-32122-2.fixed Move some tests 2024-04-21 15:43:43 -03:00
issue-32122-2.rs Move some tests 2024-04-21 15:43:43 -03:00
issue-32122-2.stderr Move some tests 2024-04-21 15:43:43 -03:00
issue-36007.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-37655.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-39823.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-53475.rs Remove track_errors entirely 2024-01-23 15:23:22 +00:00
issue-53475.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
issue-73886.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-73886.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
issue-88097.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-101066.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
mut-mut-wont-coerce.rs We do not coerce &mut &mut T -> *mut mut T 2024-05-03 20:19:20 -07:00
mut-mut-wont-coerce.stderr We do not coerce &mut &mut T -> *mut mut T 2024-05-03 20:19:20 -07:00
pin-dyn-dispatch-sound.rs Add test for dynamic dispatch + Pin::new soundness 2024-05-13 14:25:03 +02:00
pin-dyn-dispatch-sound.stderr Add test for dynamic dispatch + Pin::new soundness 2024-05-13 14:25:03 +02:00
retslot-cast.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
retslot-cast.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
sub-principals.rs Check allow instantiating object trait binder when upcasting and in new solver 2024-09-26 22:26:29 -04:00
type-errors.rs fix ICE for deref coercions with type errors 2024-02-12 14:37:35 +01:00
type-errors.stderr fix ICE for deref coercions with type errors 2024-02-12 14:37:35 +01:00
unboxing-needing-parenthases-issue-132924.rs add parentheses when unboxing suggestion needed 2024-11-12 18:23:57 +08:00
unboxing-needing-parenthases-issue-132924.stderr add parentheses when unboxing suggestion needed 2024-11-12 18:23:57 +08:00
unsafe-coercion.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00