1 // Copyright 2014 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.
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.
11 // aux-build:issue-17718.rs
13 extern crate "issue-17718" as other;
15 use std::sync::atomic;
18 const C2: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT;
20 const C4: uint = C1 * C1 + C1 / C1;
21 const C5: &'static uint = &C4;
28 static S2: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT;
32 static B: &'static uint = &A;
33 static C: &'static uint = &(A);
41 assert_eq!(C2.fetch_add(1, atomic::SeqCst), 0);
42 assert_eq!(C2.fetch_add(1, atomic::SeqCst), 0);
47 assert_eq!(S2.fetch_add(1, atomic::SeqCst), 0);
48 assert_eq!(S2.fetch_add(1, atomic::SeqCst), 1);
63 assert_eq!(other::C1, 1);
64 assert_eq!(other::C3(), ());
65 assert_eq!(other::C2.fetch_add(1, atomic::SeqCst), 0);
66 assert_eq!(other::C2.fetch_add(1, atomic::SeqCst), 0);
67 assert_eq!(other::C4, 2);
68 assert_eq!(*other::C5, 2);
69 assert_eq!(other::S1, 3);
70 assert_eq!(other::S2.fetch_add(1, atomic::SeqCst), 0);
71 assert_eq!(other::S2.fetch_add(1, atomic::SeqCst), 1);