diff --git a/rust-version b/rust-version index 2d5b9a994..ea416dc27 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -ca9a134e0985765ded9cfdde4030a5df4db7e2bd +f53b654a8882fd5fc036c4ca7a4ff41ce32497a6 diff --git a/src/tests/compiletest.md b/src/tests/compiletest.md index 4c534e9ae..53a6c0cb5 100644 --- a/src/tests/compiletest.md +++ b/src/tests/compiletest.md @@ -346,6 +346,17 @@ See also the [codegen tests](#codegen-tests) for a similar set of tests. If you need to work with `#![no_std]` cross-compiling tests, consult the [`minicore` test auxiliary](./minicore.md) chapter. +#### Conditional assembly tests based on instruction support + +Tests that depend on specific assembly instructions being available can use the +`//@ needs-asm-mnemonic: ` directive. This will skip the test if the +target backend does not support the specified instruction mnemonic. + +For example, a test that requires the `RET` instruction: +```rust,ignore +//@ needs-asm-mnemonic: RET +``` + [`tests/assembly-llvm`]: https://github.com/rust-lang/rust/tree/HEAD/tests/assembly-llvm diff --git a/src/tests/directives.md b/src/tests/directives.md index 38450d991..caa400b57 100644 --- a/src/tests/directives.md +++ b/src/tests/directives.md @@ -163,6 +163,9 @@ The following directives will check rustc build settings and target settings: For tests that cross-compile to explicit targets via `--target`, use `needs-llvm-components` instead to ensure the appropriate backend is available. +- `needs-asm-mnemonic: ` — ignores if the target backend does not + support the specified assembly mnemonic (e.g., `RET`, `NOP`). + Only supported with the LLVM backend. - `needs-profiler-runtime` — ignores the test if the profiler runtime was not enabled for the target (`build.profiler = true` in `bootstrap.toml`) - `needs-sanitizer-support` — ignores if the sanitizer support was not enabled