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
17 extern crate issue_17718 as other;
19 use std::sync::atomic::{AtomicUsize, Ordering};
22 const C2: AtomicUsize = AtomicUsize::new(0);
24 const C4: usize = C1 * C1 + C1 / C1;
25 const C5: &'static usize = &C4;
32 static S2: AtomicUsize = AtomicUsize::new(0);
36 static B: &'static usize = &A;
37 static C: &'static usize = &(A);
45 assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0);
46 assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0);
51 assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 0);
52 assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 1);
67 assert_eq!(other::C1, 1);
68 assert_eq!(other::C3(), ());
69 assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0);
70 assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0);
71 assert_eq!(other::C4, 2);
72 assert_eq!(*other::C5, 2);
73 assert_eq!(other::S1, 3);
74 assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 0);
75 assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 1);