1 // Copyright 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.
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 #![feature(const_atomic_usize_new)]
13 use std::sync::atomic::{Ordering, AtomicUsize};
24 fn new(u: U, v: V) -> Self {
27 size_of_u: mem::size_of::<U>(),
29 size_of_v: mem::size_of::<V>()
34 static COUNT: AtomicUsize = AtomicUsize::new(0);
36 impl<V, U> Drop for S<U, V> {
38 assert_eq!(mem::size_of::<U>(), self.size_of_u);
39 assert_eq!(mem::size_of::<V>(), self.size_of_v);
40 COUNT.store(COUNT.load(Ordering::SeqCst)+1, Ordering::SeqCst);
45 assert_eq!(COUNT.load(Ordering::SeqCst), 0);
46 { S::new(0u8, 1u16); }
47 assert_eq!(COUNT.load(Ordering::SeqCst), 1);