]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | #![feature(asm)] | |
12 | ||
13 | fn foo(x: isize) { println!("{}", x); } | |
14 | ||
15 | #[cfg(any(target_arch = "x86", | |
16 | target_arch = "x86_64", | |
17 | target_arch = "arm", | |
18 | target_arch = "aarch64"))] | |
19 | pub fn main() { | |
20 | let x: isize; | |
21 | x = 1; //~ NOTE prior assignment occurs here | |
22 | foo(x); | |
23 | unsafe { | |
c34b1796 | 24 | asm!("mov $1, $0" : "=r"(x) : "r"(5)); |
85aaf69f | 25 | //~^ ERROR re-assignment of immutable variable `x` |
54a0048b | 26 | //~| NOTE in this expansion of asm! |
1a4d82fc JJ |
27 | } |
28 | foo(x); | |
29 | } | |
30 | ||
31 | #[cfg(not(any(target_arch = "x86", | |
32 | target_arch = "x86_64", | |
33 | target_arch = "arm", | |
34 | target_arch = "aarch64")))] | |
35 | pub fn main() {} |