rust/tests/ui/conditional-compilation
Matthias Krüger 026d56b0f6
Rollup merge of #139967 - jieyouxu:auxiliary, r=wesleywiser
Introduce and use specialized `//@ ignore-auxiliary` for test support files instead of using `//@ ignore-test`

### Summary

Add a semantically meaningful directive for ignoring test *auxiliary* files. This is for auxiliary files that *participate* in actual tests but should not be built by `compiletest` (i.e. these files are involved through `mod xxx;` or `include!()` or `#[path = "xxx"]`, etc.).

### Motivation

A specialized directive like `//@ ignore-auxiliary` makes it way easier to audit disabled tests via `//@ ignore-test`.
  - These support files cannot use the canonical `auxiliary/` dir because they participate in module resolution or are included, or their relative paths can be important for test intention otherwise.

Follow-up to:
- #139705
- #139783
- #139740

See also discussions in:

- [#t-compiler > Directive name for non-test aux files?](512773817)
- [#t-compiler > Handling disabled `//@ ignore-test` tests](512005974)
- [#t-compiler/meetings > [steering] 2025-04-11 Dealing with disabled tests](511717981)

### Remarks on remaining unconditionally disabled tests under `tests/`

After this PR, against commit 79a272c640, only **14** remaining test files are disabled through `//@ ignore-test`:

<details>
<summary>Remaining `//@ ignore-test` files under `tests/`</summary>

```
tests/debuginfo/drop-locations.rs
4://@ ignore-test (broken, see #128971)

tests/rustdoc/macro-document-private-duplicate.rs
1://@ ignore-test (fails spuriously, see issue #89228)

tests/rustdoc/inline_cross/assoc-const-equality.rs
3://@ ignore-test (FIXME: #125092)

tests/ui/match/issue-27021.rs
7://@ ignore-test (#54987)

tests/ui/match/issue-26996.rs
7://@ ignore-test (#54987)

tests/ui/issues/issue-49298.rs
9://@ ignore-test (#54987)

tests/ui/issues/issue-59756.rs
2://@ ignore-test (rustfix needs multiple suggestions)

tests/ui/precondition-checks/write.rs
5://@ ignore-test (unimplemented)

tests/ui/precondition-checks/read.rs
5://@ ignore-test (unimplemented)

tests/ui/precondition-checks/write_bytes.rs
5://@ ignore-test (unimplemented)

tests/ui/explicit-tail-calls/drop-order.rs
2://@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊

tests/ui/panics/panic-short-backtrace-windows-x86_64.rs
3://@ ignore-test (#92000)

tests/ui/json/json-bom-plus-crlf-multifile-aux.rs
3://@ ignore-test Not a test. Used by other tests

tests/ui/traits/next-solver/object-soundness-requires-generalization.rs
2://@ ignore-test (see #114196)
```
</details>

Of these, most are either **unimplemented**, or **spurious**, or **known-broken**. The outstanding one is `tests/ui/json/json-bom-plus-crlf-multifile-aux.rs` which I did not want to touch in *this* PR -- that aux file has load-bearing BOM and carriage returns and byte offset matters. I think those test files that require special encoding / BOM probably are better off as `run-make` tests. See #139968 for that aux file.

### Review advice

- Best reviewed commit-by-commit.
- The directive name diverged from the most voted `//@ auxiliary` because I think that's easy to confuse with `//@ aux-{crate,dir}`.

r? compiler
2025-04-17 21:53:25 +02:00
..
auxiliary
cfg-arg-invalid-1.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-1.stderr
cfg-arg-invalid-2.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-2.stderr
cfg-arg-invalid-3.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
cfg-arg-invalid-3.stderr
cfg-arg-invalid-4.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-4.stderr
cfg-arg-invalid-5.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
cfg-arg-invalid-5.stderr
cfg-arg-invalid-6.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-6.stderr
cfg-arg-invalid-7.rs
cfg-arg-invalid-7.stderr
cfg-arg-invalid-8.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-8.stderr
cfg-arg-invalid-9.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-arg-invalid-9.stderr
cfg-attr-cfg-2.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
cfg-attr-cfg-2.stderr compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
cfg-attr-crate-2.rs
cfg-attr-crate-2.stderr
cfg-attr-empty-is-unused.rs
cfg-attr-empty-is-unused.stderr
cfg-attr-invalid-predicate.rs
cfg-attr-invalid-predicate.stderr
cfg-attr-multi-false.rs
cfg-attr-multi-invalid-1.rs
cfg-attr-multi-invalid-1.stderr
cfg-attr-multi-invalid-2.rs
cfg-attr-multi-invalid-2.stderr
cfg-attr-multi-true.rs
cfg-attr-multi-true.stderr
cfg-attr-parse.rs
cfg-attr-parse.stderr More sophisticated span trimming 2025-02-21 00:41:17 +00:00
cfg-attr-syntax-validation.rs Remove NtExpr and NtLiteral. 2025-04-02 06:20:35 +11:00
cfg-attr-syntax-validation.stderr Remove NtExpr and NtLiteral. 2025-04-02 06:20:35 +11:00
cfg-attr-unknown-attribute-macro-expansion.rs
cfg-attr-unknown-attribute-macro-expansion.stderr
cfg-empty-codemap.rs UI tests: migrate remaining compile time error-patterns to line annotations 2025-04-13 21:48:53 +03:00
cfg-empty-codemap.stderr
cfg-generic-params.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg-generic-params.stderr Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg-in-crate-1.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg-in-crate-1.stderr Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg-non-opt-expr.rs Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg-non-opt-expr.stderr Use cfg(false) in UI tests 2025-04-03 21:41:58 +00:00
cfg_accessible-bugs.rs
cfg_accessible-bugs.stderr
cfg_accessible-input-validation.rs
cfg_accessible-input-validation.stderr
cfg_accessible-not_sure.edition2015.stderr
cfg_accessible-not_sure.edition2021.stderr
cfg_accessible-not_sure.rs replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
cfg_accessible-private.rs
cfg_accessible-stuck.rs
cfg_accessible-stuck.stderr
cfg_accessible-unstable.rs use backticks instead of single quotes when reporting "use of unstable library feature" 2024-11-03 13:55:52 -08:00
cfg_accessible-unstable.stderr use backticks instead of single quotes when reporting "use of unstable library feature" 2024-11-03 13:55:52 -08:00
cfg_accessible.rs
cfg_accessible.stderr
cfg_attr_path.rs
inner-cfg-non-inline-mod.rs
invalid-node-range-issue-129166.rs expand: Leave traces when expanding cfg attributes 2025-03-26 15:30:12 +03:00
issue-34028.rs
module_with_cfg.rs Rollup merge of #139967 - jieyouxu:auxiliary, r=wesleywiser 2025-04-17 21:53:25 +02:00
test-cfg.rs
test-cfg.stderr