about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Poveda <christian.poveda@ferrous-systems.com>2025-09-21 16:56:04 -0500
committerChristian Poveda <christian.poveda@ferrous-systems.com>2025-10-02 11:13:22 -0500
commit6631c8ef5569920daba2e4ac46ac783b3a7c9c47 (patch)
tree3b3c24dd7d1618b3da1644ddd74649612c84de1a
parentc61ec946d24c559708d4d57fbe860817e854c610 (diff)
downloadrust-6631c8ef5569920daba2e4ac46ac783b3a7c9c47.tar.gz
rust-6631c8ef5569920daba2e4ac46ac783b3a7c9c47.zip
Document range syntax on the rustc dev guide
-rw-r--r--src/doc/rustc-dev-guide/src/tests/directives.md14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md
index 4be78fac4ec..3b6c8917464 100644
--- a/src/doc/rustc-dev-guide/src/tests/directives.md
+++ b/src/doc/rustc-dev-guide/src/tests/directives.md
@@ -262,6 +262,20 @@ Consider writing the test as a proper incremental test instead.
 
 </div>
 
+#### The edition directive
+
+The `//@ edition` directive can take an exact edition, a bounded half-open range of editions or a left-bounded half-open range of editions, this affects which edition is used by `./x test` to run the test. For example:
+
+- A test with the `//@ edition: 2018` directive will only run under the 2018 edition.
+- A test with the `//@ edition: 2015..2021` directive can be run under both the 2015 and 2018 editions. However, CI will only run the test with the lowest edition possible (2015 in this case).
+- A test with the `//@ edition: 2018..` directive will run under any edition greater or equal than 2018. However, CI will only run the test with the lowest edition possible (2018 in this case).
+
+You can also force `./x test` to use a specific edition by passing the `-- --edition=` argument. However, tests with the `//@ edition` directive will clamp the value passed to the argument. For example, if we run `./x test -- --edition=2015`:
+
+- A test with the `//@ edition: 2018` will run with the 2018 edition. 
+- A test with the `//@ edition: 2015..2021` will be run with the 2015 edition. 
+- A test with the `//@ edition: 2018..` will run with the 2018 edition. 
+
 ### Rustdoc
 
 | Directive   | Explanation                                                  | Supported test suites                   | Possible values           |