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.
12 use std::cell::UnsafeCell;
14 struct MyUnsafePack<T>(UnsafeCell<T>);
16 unsafe impl<T: Send> Sync for MyUnsafePack<T> {}
19 value: MyUnsafePack<T>
23 fn forbidden(&self) {}
26 unsafe impl<T: Send> Sync for MyUnsafe<T> {}
30 VariantUnsafe(UnsafeCell<T>)
33 unsafe impl<T: Send> Sync for UnsafeEnum<T> {}
35 static STATIC1: UnsafeEnum<int> = UnsafeEnum::VariantSafe;
37 static STATIC2: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
38 const CONST: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
39 static STATIC3: MyUnsafe<int> = MyUnsafe{value: CONST};
41 static STATIC4: &'static MyUnsafePack<int> = &STATIC2;
47 unsafe impl<T: Send> Sync for Wrap<T> {}
49 static UNSAFE: MyUnsafePack<int> = MyUnsafePack(UnsafeCell{value: 2});
50 static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack<int>> = Wrap { value: &UNSAFE };