rust/tests/ui/drop
Matthias Krüger e96bb6ae1c
Rollup merge of #135926 - jieyouxu:needs-subprocess-thread, r=oli-obk
Implement `needs-subprocess` directive, and cleanup a bunch of tests to use `needs-{subprocess,threads}`

### Summary

Closes #128295.

- Implements `//@ needs-subprocess` directive in compiletest as requested in #128295. However, compiletest is a host tool, so we can't just try to spawn process because that spawns the process on *host*, not the *target*, under cross-compilation scenarios.
    - The short-term solution is to add *Yet Another* list of allow-list targets.
    - The long-term solution is to first check if a `$target` supports std, then try to run a binary to do run-time capability detection *on the target*. But that is tricky because you have to build-and-run a binary *for the target*.
    - This PR picks the short-term solution, because the long-term solution is highly non-trivial, and it's already an improvement over individual `ignore-*`s all over the place.
    - Opened an issue about the long-term solution in #135928.
- Documents `//@ needs-subprocess` in rustc-dev-guide.
- Replace `ignore-{wasm,wasm32,emscripten,sgx}` with `needs-{subprocess,threads}` where suitable in tests.
- Some drive-by test changes as I was trying to figure out if I could use `needs-{subprocess,threads}` and found some bits needlessly distracting.

Count of tests that use `ignore-{wasm,wasm32,emscripten,sgx}` before and after this PR:

| State | `ignore-sgx` | `ignore-wasm` | `ignore-emscripten` |
| - | - | - | - |
| Before this PR | 96 | 88 | 207 |
| After this PR | 36 | 38 | 61 |

<details>
<summary>Commands used to find out locally</summary>

```
--- before

[17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-sgx" tests | wc -l
96
[17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-wasm" tests | wc -l
88
[17:40] Joe:rust (fresh) | rg --no-ignore -l "ignore-emscripten" tests | wc -l
207

--- after

[17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-sgx" tests | wc -l
36
[17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-wasm" tests | wc -l
38
[17:39] Joe:rust (needs-subprocess-thread) | rg --no-ignore -l "ignore-emscripten" tests | wc -l
61
```
</details>

### Review advice

- Best reviewed commit-by-commit.
- Non-trivial test changes (not mechanically simple replacements) are split into individual commits to help with review. Their individual commit messages give some basic description of the changes.
- I *could* split some test changes out into another PR, but I found that I needed to change some tests to `needs-threads`, some to `needs-subprocess`, and some needed to use *both*, so they might conflict and become very annoying.

---

r? ``@ghost`` (need to run try jobs)

try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: i686-mingw
try-job: x86_64-mingw-1
try-job: x86_64-apple-1
try-job: aarch64-apple
try-job: aarch64-gnu
try-job: test-various
try-job: armhf-gnu
2025-01-24 16:25:43 +01:00
..
auxiliary Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
drop_elaboration_with_errors.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop_elaboration_with_errors.stderr Bail out of drop elaboration when encountering error types 2024-02-08 17:51:32 +00:00
drop_order_if_let_rescope.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
drop_order.rs Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
drop-foreign-fundamental.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
drop-foreign-fundamental.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
drop-if-let-binding.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-on-empty-block-exit.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-on-ret.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-order-comparisons.e2021.fixed Add extensive set of drop order tests 2025-01-23 22:48:03 +00:00
drop-order-comparisons.e2021.stderr Add extensive set of drop order tests 2025-01-23 22:48:03 +00:00
drop-order-comparisons.rs Add extensive set of drop order tests 2025-01-23 22:48:03 +00:00
drop-struct-as-object.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
drop-struct-as-object.stderr Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
drop-trait-enum.rs tests: use needs-threads instead of ignore-emscripten 2025-01-23 20:51:29 +08:00
drop-trait-generic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-trait.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-uninhabited-enum.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
drop-with-type-ascription-1.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
drop-with-type-ascription-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck_legal_cycles.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck-eyepatch-extern-crate.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck-eyepatch-manuallydrop.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dropck-eyepatch-reorder.rs Allow newly added non_local_definitions lint in tests 2024-02-17 13:59:45 +01:00
dropck-eyepatch.rs Allow newly added non_local_definitions lint in tests 2024-02-17 13:59:45 +01:00
dynamic-drop-async.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
dynamic-drop.rs Error on using yield without also using #[coroutine] on the closure 2024-04-24 08:05:29 +00:00
if-let-rescope-borrowck-suggestions.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
if-let-rescope-borrowck-suggestions.stderr stabilize if_let_rescope 2024-10-24 04:33:14 +08:00
issue-979.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-2734.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-2735-2.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-2735-3.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-2735.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-10028.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
issue-17718-const-destructors.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-21486.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-23338-ensure-param-drop-order.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
issue-23611-enum-swap-in-drop.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
issue-30018-nopanic.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-35546.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-48962.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
issue-90752-raw-ptr-shenanigans.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-90752.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-100276.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-103107.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
issue-110682.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
lint-if-let-rescope-gated.edition2021.stderr Use links to edition guide for edition migrations 2024-12-15 20:28:16 -08:00
lint-if-let-rescope-gated.rs Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
lint-if-let-rescope-with-macro.rs stabilize if_let_rescope 2024-10-24 04:33:14 +08:00
lint-if-let-rescope-with-macro.stderr Properly record metavar spans for other expansions other than TT 2024-12-21 20:37:27 +00:00
lint-if-let-rescope.fixed reduce false positives on some common cases from if-let-rescope 2024-12-02 18:30:29 +08:00
lint-if-let-rescope.rs reduce false positives on some common cases from if-let-rescope 2024-12-02 18:30:29 +08:00
lint-if-let-rescope.stderr Use links to edition guide for edition migrations 2024-12-15 20:28:16 -08:00
lint-tail-expr-drop-order-borrowck.rs Try to explain borrow for tail expr temporary drop order change in 2024 2025-01-08 16:02:44 +00:00
lint-tail-expr-drop-order-borrowck.stderr Try to explain borrow for tail expr temporary drop order change in 2024 2025-01-08 16:02:44 +00:00
lint-tail-expr-drop-order-gated.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
lint-tail-expr-drop-order.rs Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
lint-tail-expr-drop-order.stderr Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
missing-drop-method.rs Convert bugs back to delayed_bugs. 2024-02-21 10:35:54 +11:00
missing-drop-method.stderr Convert bugs back to delayed_bugs. 2024-02-21 10:35:54 +11:00
no-drop-flag-size.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
nondrop-cycle.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
norm-ice-106444.rs add test for ICE #106444 2024-03-23 12:38:50 +01:00
recursion-check-on-erroneous-impl.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
recursion-check-on-erroneous-impl.stderr Avoid ICE in drop recursion check in case of invalid drop impls 2024-02-08 17:33:04 +00:00
repeat-drop-2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
repeat-drop-2.stderr Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
repeat-drop.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
static-issue-17302.rs Update tests for hidden references to mutable static 2024-09-13 14:10:56 +03:00
tail_expr_drop_order-on-coroutine-unwind.rs Always run tail_expr_drop_order lint on promoted MIR 2024-12-23 20:25:41 +00:00
tail_expr_drop_order-on-coroutine-unwind.stderr Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
tail_expr_drop_order-on-recursive-boxed-fut.rs Don't create cycles by normalizing opaques defined in the body we're checking 2025-01-08 15:58:10 +00:00
tail_expr_drop_order-on-thread-local.rs Don't do AccessDepth::Drop for types with no drop impl 2025-01-08 15:58:10 +00:00
tail-expr-drop-order-negative.edition2024.stderr Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
tail-expr-drop-order-negative.rs Update more 2024 tests to remove -Zunstable-options 2024-11-28 14:32:45 -08:00
tail-expr-drop-order.rs Stabilize the 2024 edition 2024-11-22 11:12:15 -08:00
terminate-in-initializer.rs tests: use needs-threads instead of ignore-emscripten 2025-01-23 20:51:29 +08:00
use_inline_dtor.rs tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00