diff options
| author | jam1garner <8260240+jam1garner@users.noreply.github.com> | 2022-04-01 12:24:04 -0400 |
|---|---|---|
| committer | jam1garner <8260240+jam1garner@users.noreply.github.com> | 2022-04-01 12:24:04 -0400 |
| commit | bf26d87df669d706c7897ca168c04bdeefb78bc5 (patch) | |
| tree | c204b8f9f3903a4a6f6ee81874ce9679530ad7cd | |
| parent | 0df84cdc4979e53dbeb1620b8db1096a16271a85 (diff) | |
| download | rust-bf26d87df669d706c7897ca168c04bdeefb78bc5.tar.gz rust-bf26d87df669d706c7897ca168c04bdeefb78bc5.zip | |
Add regression test for naked functions with invalid asm syntax
| -rw-r--r-- | src/test/ui/asm/naked-functions.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/asm/naked-functions.stderr | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/test/ui/asm/naked-functions.rs b/src/test/ui/asm/naked-functions.rs index a8fd24a3e07..2a57afa1a6a 100644 --- a/src/test/ui/asm/naked-functions.rs +++ b/src/test/ui/asm/naked-functions.rs @@ -209,3 +209,9 @@ pub unsafe extern "C" fn allow_compile_error_and_asm(a: u32) -> u32 { //~^ ERROR this is a user specified error asm!("", options(noreturn)) } + +#[naked] +pub unsafe extern "C" fn invalid_asm_syntax(a: u32) -> u32 { + asm!(invalid_syntax) + //~^ ERROR asm template must be a string literal +} diff --git a/src/test/ui/asm/naked-functions.stderr b/src/test/ui/asm/naked-functions.stderr index 32eae1f37a3..7bbe49c3b19 100644 --- a/src/test/ui/asm/naked-functions.stderr +++ b/src/test/ui/asm/naked-functions.stderr @@ -16,6 +16,12 @@ error: this is a user specified error LL | compile_error!("this is a user specified error"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: asm template must be a string literal + --> $DIR/naked-functions.rs:215:10 + | +LL | asm!(invalid_syntax) + | ^^^^^^^^^^^^^^ + error: patterns not allowed in naked function parameters --> $DIR/naked-functions.rs:20:5 | @@ -267,6 +273,6 @@ error: naked functions cannot be inlined LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ -error: aborting due to 32 previous errors; 2 warnings emitted +error: aborting due to 33 previous errors; 2 warnings emitted For more information about this error, try `rustc --explain E0787`. |
