-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate test file for invalid sym operand
- Loading branch information
1 parent
be66415
commit b73077e
Showing
8 changed files
with
80 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::arch::{asm, global_asm}; | ||
|
||
fn main() { | ||
unsafe { | ||
// Sym operands must point to a function or static | ||
|
||
let x: u64 = 0; | ||
const C: i32 = 0; | ||
static S: i32 = 0; | ||
asm!("{}", sym S); | ||
asm!("{}", sym main); | ||
asm!("{}", sym C); | ||
//~^ ERROR invalid `sym` operand | ||
asm!("{}", sym x); | ||
//~^ ERROR invalid `sym` operand | ||
} | ||
} | ||
|
||
unsafe fn generic<T>() { | ||
asm!("{}", sym generic::<T>); | ||
} | ||
|
||
// Sym operands must point to a function or static | ||
|
||
const C: i32 = 0; | ||
static S: i32 = 0; | ||
global_asm!("{}", sym S); | ||
global_asm!("{}", sym main); | ||
global_asm!("{}", sym C); | ||
//~^ ERROR invalid `sym` operand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: invalid `sym` operand | ||
--> $DIR/invalid-sym-operand.rs:14:24 | ||
| | ||
LL | asm!("{}", sym x); | ||
| ^ is a local variable | ||
| | ||
= help: `sym` operands must refer to either a function or a static | ||
|
||
error: invalid `sym` operand | ||
--> $DIR/invalid-sym-operand.rs:12:20 | ||
| | ||
LL | asm!("{}", sym C); | ||
| ^^^^^ is an `i32` | ||
| | ||
= help: `sym` operands must refer to either a function or a static | ||
|
||
error: invalid `sym` operand | ||
--> $DIR/invalid-sym-operand.rs:29:19 | ||
| | ||
LL | global_asm!("{}", sym C); | ||
| ^^^^^ is an `i32` | ||
| | ||
= help: `sym` operands must refer to either a function or a static | ||
|
||
error: aborting due to 3 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters