about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-10-02 10:27:51 +0200
committerGitHub <noreply@github.com>2025-10-02 10:27:51 +0200
commitb78b1070e32dde0c5d3fba9f2bc8506cc042bb3a (patch)
treef6edf408259754c3fecb3675f20e83ef64c4f89d /tests
parente041b2c07830a561d3224338aec4c9e520791e67 (diff)
parent59c4dfe59d587f0f09746958bf9a16c271cc02a7 (diff)
downloadrust-b78b1070e32dde0c5d3fba9f2bc8506cc042bb3a.tar.gz
rust-b78b1070e32dde0c5d3fba9f2bc8506cc042bb3a.zip
Rollup merge of #147221 - Zalathar:incremental, r=lqd
Forbid `//@ compile-flags: -Cincremental=` in tests

Tests should not try to manually enable incremental compilation with `-Cincremental`, because that typically results in stray directories being created in the repository root.

Also, if the incremental directory is not cleared, there is a risk of interference between successive runs of the same test.

Instead, use the `//@ incremental` directive, which instructs compiletest to handle the details of passing `-Cincremental` with a fresh directory.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/compiletest-self-test/compile-flags-incremental.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/compiletest-self-test/compile-flags-incremental.rs b/tests/ui/compiletest-self-test/compile-flags-incremental.rs
new file mode 100644
index 00000000000..62a1ad84d8f
--- /dev/null
+++ b/tests/ui/compiletest-self-test/compile-flags-incremental.rs
@@ -0,0 +1,17 @@
+//@ revisions: good bad bad-space
+//@ check-pass
+
+//@[bad] compile-flags: -Cincremental=true
+//@[bad] should-fail
+
+//@[bad-space] compile-flags:  -C  incremental=dir
+//@[bad-space] should-fail
+
+fn main() {}
+
+// Tests should not try to manually enable incremental compilation with
+// `-Cincremental`, because that typically results in stray directories being
+// created in the repository root.
+//
+// Instead, use the `//@ incremental` directive, which instructs compiletest
+// to handle the details of passing `-Cincremental` with a fresh directory.