about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-25 16:48:20 +0200
committerGitHub <noreply@github.com>2024-07-25 16:48:20 +0200
commite76bb3fab618f7d75ab4467362abb35e66912c80 (patch)
tree8417303ffd189aa6f208cd79061c02d04e3414b7 /tests
parentd1070df553d84d8409f890745a9fdb2eb10cbb64 (diff)
parent4b7a87de1094522c5c6e5a7bda04e0e0b281e049 (diff)
downloadrust-e76bb3fab618f7d75ab4467362abb35e66912c80.tar.gz
rust-e76bb3fab618f7d75ab4467362abb35e66912c80.zip
Rollup merge of #128138 - folkertdev:asm-option-allowlist, r=lcnr
`#[naked]`: use an allowlist for allowed options on `asm!` in naked functions

tracking issue: https://github.com/rust-lang/rust/issues/90957

this is mostly just a refactor, but using an allowlist (rather than a denylist) for which asm options are allowed in naked functions is a little safer.

These options are disallowed because naked functions are effectively global asm, but defined using inline asm.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/asm/naked-functions.rs2
-rw-r--r--tests/ui/asm/naked-functions.stderr2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs
index 1619ebfcf39..6b2d2aea238 100644
--- a/tests/ui/asm/naked-functions.rs
+++ b/tests/ui/asm/naked-functions.rs
@@ -111,7 +111,7 @@ unsafe extern "C" fn invalid_options() {
 unsafe extern "C" fn invalid_options_continued() {
     asm!("", options(readonly, nostack), options(pure));
     //~^ ERROR asm with the `pure` option must have at least one output
-    //~| ERROR asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
+    //~| ERROR asm options unsupported in naked functions: `pure`, `readonly`, `nostack`
     //~| ERROR asm in naked functions must use `noreturn` option
 }
 
diff --git a/tests/ui/asm/naked-functions.stderr b/tests/ui/asm/naked-functions.stderr
index 77bc80a101f..4dd9e29bdc6 100644
--- a/tests/ui/asm/naked-functions.stderr
+++ b/tests/ui/asm/naked-functions.stderr
@@ -212,7 +212,7 @@ error[E0787]: asm options unsupported in naked functions: `nomem`, `preserves_fl
 LL |     asm!("", options(nomem, preserves_flags, noreturn));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0787]: asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
+error[E0787]: asm options unsupported in naked functions: `pure`, `readonly`, `nostack`
   --> $DIR/naked-functions.rs:112:5
    |
 LL |     asm!("", options(readonly, nostack), options(pure));