我在test.s
中有以下代码:
call $8 + $8
运行nasm test.s
编译成功。我期望下面等效的Rust代码也能够编译成功,但是它没有。
在test.rs
中:
#![feature(asm)]
fn main() {
unsafe {
asm! (
"call $0 + $0"
:
: "i" (8)
: "memory"
: "volatile"
)
}
}
rustc test.rs
的输出结果:
test.rs:4:9: 10:11 error: <inline asm>:1:12: error: invalid token in expression
call $8 + $8
^