Skip to content

Commit 026d56b

Browse files
authored
Rollup merge of rust-lang#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: - rust-lang#139705 - rust-lang#139783 - rust-lang#139740 See also discussions in: - [#t-compiler > Directive name for non-test aux files?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Directive.20name.20for.20non-test.20aux.20files.3F/with/512773817) - [#t-compiler > Handling disabled &rust-lang#96;//@ ignore-test&rust-lang#96; tests](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Handling.20disabled.20.60.2F.2F.40.20ignore-test.60.20tests/with/512005974) - [#t-compiler/meetings > &rust-lang#91;steering&rust-lang#93; 2025-04-11 Dealing with disabled tests](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bsteering.5D.202025-04-11.20Dealing.20with.20disabled.20tests/with/511717981) ### Remarks on remaining unconditionally disabled tests under `tests/` After this PR, against commit 79a272c, 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 rust-lang#128971) tests/rustdoc/macro-document-private-duplicate.rs 1://@ ignore-test (fails spuriously, see issue rust-lang#89228) tests/rustdoc/inline_cross/assoc-const-equality.rs 3://@ ignore-test (FIXME: rust-lang#125092) tests/ui/match/issue-27021.rs 7://@ ignore-test (rust-lang#54987) tests/ui/match/issue-26996.rs 7://@ ignore-test (rust-lang#54987) tests/ui/issues/issue-49298.rs 9://@ ignore-test (rust-lang#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 (rust-lang#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 rust-lang#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 rust-lang#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
2 parents 8b7a289 + 6c5a481 commit 026d56b

File tree

48 files changed

+56
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+56
-60
lines changed

src/doc/rustc-dev-guide/src/tests/best-practices.md

+2

src/doc/rustc-dev-guide/src/tests/directives.md

+3

src/tools/compiletest/src/directive-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
4444
"ignore-arm-unknown-linux-gnueabihf",
4545
"ignore-arm-unknown-linux-musleabi",
4646
"ignore-arm-unknown-linux-musleabihf",
47+
"ignore-auxiliary",
4748
"ignore-avr",
4849
"ignore-beta",
4950
"ignore-cdb",

src/tools/compiletest/src/header/cfg.rs

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ fn parse_cfg_name_directive<'a>(
100100
name: "test",
101101
message: "always"
102102
}
103+
condition! {
104+
name: "auxiliary",
105+
message: "used by another main test file"
106+
}
103107
condition! {
104108
name: &config.target,
105109
allowed_names: &target_cfgs.all_targets,

src/tools/compiletest/src/header/tests.rs

+6
Original file line numberDiff line numberDiff line change
@@ -940,3 +940,9 @@ fn test_supported_crate_types() {
940940
"//@ needs-crate-type: bin, cdylib, dylib, lib, proc-macro, rlib, staticlib"
941941
));
942942
}
943+
944+
#[test]
945+
fn test_ignore_auxiliary() {
946+
let config = cfg().build();
947+
assert!(check_ignore(&config, "//@ ignore-auxiliary"));
948+
}

tests/codegen/remap_path_prefix/aux_mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: this is not a test
1+
//@ ignore-auxiliary (used by `./main.rs`)
22

33
#[inline]
44
pub fn some_aux_mod_function() -> i32 {

tests/debuginfo/drop-locations.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ ignore-android
2-
//@ ignore-test: #128971
2+
3+
// FIXME: stepping with "next" in a debugger skips past end-of-scope drops
4+
//@ ignore-test (broken, see #128971)
35

46
#![allow(unused)]
57

tests/ui/borrowck/move-error-snippets-ext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./move-error-snippets.rs`)
22

33
macro_rules! aaa {
44
($c:ident) => {{

tests/ui/codemap_tests/two_files_data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./two_files.rs`)
22

33
trait Foo { }
44

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./inner-cfg-non-inline-mod.rs`)
22

33
#![cfg_attr(all(), cfg(false))]

tests/ui/cross/cross-file-errors/underscore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./main.rs`)
22
#![crate_type = "lib"]
33

44
macro_rules! underscore {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test not a test, auxiliary
1+
//@ ignore-auxiliary (used by `../../macro-expanded-mod.rs`)
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test not a test, auxiliary
1+
//@ ignore-auxiliary (used by `../../macro-expanded-mod.rs`)
22

33
mod_decl!(bar);

tests/ui/directory_ownership/mod_file_not_owning_aux1.rs

-6
This file was deleted.

tests/ui/directory_ownership/mod_file_not_owning_aux2.rs

-1
This file was deleted.

tests/ui/directory_ownership/mod_file_not_owning_aux3.rs

-3
This file was deleted.
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test auxiliary file for expansion-time.rs
1+
//@ ignore-auxiliary (used by `./expansion-time.rs`)
22

33
1
44
2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: not a test
1+
//@ ignore-auxiliary (used by `./root.rs`)
22

33
#[allow(tool::lint)]
44
pub fn foo() {}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test: not a test
1+
//@ ignore-auxiliary (used by `./lint-pre-expansion-extern-module.rs`)
22

33
pub fn try() {}

tests/ui/lint/unknown-lints/other.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//@ ignore-test (auxiliary)
2-
3-
// Companion to allow-in-other-module.rs
1+
//@ ignore-auxiliary (used by `./allow-in-other-module.rs`)
42

53
// This should not warn.
64
#![allow(not_a_real_lint)]
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
// ignore-test: this is not a test
2-
31
1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
// ignore-test: this is not a test
2-
31
fn foo() { bar() }

tests/ui/macros/include-single-expr-helper-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test auxiliary file for include-single-expr.rs
1+
//@ ignore-auxiliary (used by `./include-single-expr.rs`)
22

33
0
44

tests/ui/macros/include-single-expr-helper.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test auxiliary file for include-single-expr.rs
1+
//@ ignore-auxiliary (used by `./include-single-expr.rs`)
22

33
0
44
10
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test -- this is an auxiliary file as part of another test.
1+
//@ ignore-auxiliary (used by `../issue-69838-mods-relative-to-included-path.rs`)
22

33
pub fn i_am_in_bar() {}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test -- this is an auxiliary file as part of another test.
1+
//@ ignore-auxiliary (used by `../issue-69838-mods-relative-to-included-path.rs`)
22

33
pub mod bar;

tests/ui/macros/macro-expanded-include/foo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../test.rs`)
22

33
macro_rules! m {
44
() => { include!("file.txt"); }

tests/ui/missing_non_modrs_mod/foo.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//
2-
//@ ignore-test this is just a helper for the real test in this dir
1+
//@ ignore-auxiliary (used by `./missing_non_modrs_mod.rs`)
32

43
mod missing;

tests/ui/missing_non_modrs_mod/foo_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test this is just a helper for the real test in this dir
1+
//@ ignore-auxiliary (used by `./missing_non_modrs_mod_inline.rs`)
22

33
mod inline {
44
mod missing;

tests/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0583]: file not found for module `missing`
2-
--> $DIR/foo.rs:4:1
2+
--> $DIR/foo.rs:3:1
33
|
44
LL | mod missing;
55
| ^^^^^^^^^^^^

tests/ui/modules/mod_file_aux.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ run-pass
2-
//@ ignore-test Not a test. Used by other tests
1+
//@ ignore-auxiliary (used by `./mod_file_with_path_attr.rs` and `mod_file.rs`)
32

43
pub fn foo() -> isize { 10 }
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test Not a test. Used by other tests
1+
//@ ignore-auxiliary (used by `./mod_file_correct_spans.rs`)
22

33
pub fn foo() -> isize { 10 }
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test not a test. aux file
1+
//@ ignore-auxiliary (used by `./mod_file_disambig.rs`)
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test not a test. aux file
1+
//@ ignore-auxiliary (used by `../mod_file_disambig.rs`)

tests/ui/non_modrs_mods/foors_mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//@ run-pass
2-
//
3-
//@ ignore-test: not a test, used by non_modrs_mods.rs
1+
//@ ignore-auxiliary (used by `./non_modrs_mods.rs`)
42

53
pub mod inner_modrs_mod;
64
pub mod inner_foors_mod;

tests/ui/non_modrs_mods_and_inline_mods/x.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: not a test
1+
//@ ignore-auxiliary (used by `./non_modrs_mods_and_inline_mods.rs`)
22

33
pub mod y {
44
pub mod z;
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test: not a test
1+
//@ ignore-auxiliary (used by `../../../non_modrs_mods_and_inline_mods.rs`)

tests/ui/numbers-arithmetic/saturating-float-casts-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./saturating-float-casts.rs` and `./saturating-float-casts-wasm.rs`)
22

33
// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction.
44
//

tests/ui/parser/circular_modules_hello.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: this is an auxiliary file for circular-modules-main.rs
1+
//@ ignore-auxiliary (used by `./circular-modules-main.rs`)
22

33
#[path = "circular_modules_main.rs"]
44
mod circular_modules_main;

tests/ui/parser/issues/circular-module-with-doc-comment-issue-97589/recursive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: this is an auxiliary file for circular-module-with-doc-comment-issue-97589.rs
1+
//@ ignore-auxiliary (used by `./circular-module-with-doc-comment-issue-97589.rs`)
22

33
//! this comment caused the circular dependency checker to break
44

tests/ui/parser/issues/issue-48508-aux.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//@ run-pass
2-
//@ ignore-test Not a test. Used by issue-48508.rs
1+
//@ ignore-auxiliary (used by `./issue-48508.rs`)
32

43
pub fn other() -> f64 {
54
let µ = 1.0;

tests/ui/proc-macro/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./attributes-on-modules-fail.rs`)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../inner-attr-non-inline-mod.rs`)
22

33
#![rustfmt::skip]
44
#![print_attr]

tests/ui/proc-macro/outer/inner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../attributes-on-modules-fail.rs`)

tests/ui/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
22

33
#[derive(Print)]
44
enum ProceduralMasqueradeDummyType {

tests/ui/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
22

33
#[derive(Print)]
44
enum ProceduralMasqueradeDummyType {

tests/ui/proc-macro/pretty-print-hack/rental-0.5.6/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `../../../pretty-print-hack/hide.rs`)
22

33
#[derive(Print)]
44
enum ProceduralMasqueradeDummyType {

tests/ui/runtime/backtrace-debuginfo-aux.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
//@ run-pass
2-
//@ ignore-test: not a test, used by backtrace-debuginfo.rs to test file!()
1+
//@ ignore-auxiliary (used by `./backtrace-debuginfo.rs` to test `file!()`)
32

43
#[inline(never)]
54
pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {

0 commit comments

Comments
 (0)