blob: 666d2c677834bff870bbfb0d29899074f270f4d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// needs-asm-support
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
use std::arch::asm;
fn main() {
unsafe {
// Can't output to borrowed values.
let mut a = 0isize;
let p = &a;
asm!("{}", out(reg) a);
//~^ cannot assign to `a` because it is borrowed
println!("{}", p);
// Can't read from mutable borrowed values.
let mut a = 0isize;
let p = &mut a;
asm!("{}", in(reg) a);
//~^ cannot use `a` because it was mutably borrowed
println!("{}", p);
}
}
|