Skip to content

Commit bf26d87

Browse files
committed
Add regression test for naked functions with invalid asm syntax
1 parent 0df84cd commit bf26d87

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/test/ui/asm/naked-functions.rs

+6
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,9 @@ pub unsafe extern "C" fn allow_compile_error_and_asm(a: u32) -> u32 {
209209
//~^ ERROR this is a user specified error
210210
asm!("", options(noreturn))
211211
}
212+
213+
#[naked]
214+
pub unsafe extern "C" fn invalid_asm_syntax(a: u32) -> u32 {
215+
asm!(invalid_syntax)
216+
//~^ ERROR asm template must be a string literal
217+
}

src/test/ui/asm/naked-functions.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ error: this is a user specified error
1616
LL | compile_error!("this is a user specified error");
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818

19+
error: asm template must be a string literal
20+
--> $DIR/naked-functions.rs:215:10
21+
|
22+
LL | asm!(invalid_syntax)
23+
| ^^^^^^^^^^^^^^
24+
1925
error: patterns not allowed in naked function parameters
2026
--> $DIR/naked-functions.rs:20:5
2127
|
@@ -267,6 +273,6 @@ error: naked functions cannot be inlined
267273
LL | #[inline(never)]
268274
| ^^^^^^^^^^^^^^^^
269275

270-
error: aborting due to 32 previous errors; 2 warnings emitted
276+
error: aborting due to 33 previous errors; 2 warnings emitted
271277

272278
For more information about this error, try `rustc --explain E0787`.

0 commit comments

Comments
 (0)