Add regression test for naked functions with invalid asm syntax
This commit is contained in:
parent
0df84cdc49
commit
bf26d87df6
2 changed files with 13 additions and 1 deletions
|
@ -209,3 +209,9 @@ pub unsafe extern "C" fn allow_compile_error_and_asm(a: u32) -> u32 {
|
||||||
//~^ ERROR this is a user specified error
|
//~^ ERROR this is a user specified error
|
||||||
asm!("", options(noreturn))
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,12 @@ error: this is a user specified error
|
||||||
LL | compile_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
|
error: patterns not allowed in naked function parameters
|
||||||
--> $DIR/naked-functions.rs:20:5
|
--> $DIR/naked-functions.rs:20:5
|
||||||
|
|
|
|
||||||
|
@ -267,6 +273,6 @@ error: naked functions cannot be inlined
|
||||||
LL | #[inline(never)]
|
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`.
|
For more information about this error, try `rustc --explain E0787`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue