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.
14 use std::cell::UnsafeCell;
16 struct MyUnsafePack<T>(UnsafeCell<T>);
18 unsafe impl<T: Send> Sync for MyUnsafePack<T> {}
21 value: MyUnsafePack<T>
25 fn forbidden(&self) {}
28 unsafe impl<T: Send> Sync for MyUnsafe<T> {}
32 VariantUnsafe(UnsafeCell<T>)
35 unsafe impl<T: Send> Sync for UnsafeEnum<T> {}
37 static STATIC1: UnsafeEnum<int> = UnsafeEnum::VariantSafe;
39 static STATIC2: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
40 const CONST: MyUnsafePack<int> = MyUnsafePack(UnsafeCell { value: 1 });
41 static STATIC3: MyUnsafe<int> = MyUnsafe{value: CONST};
43 static STATIC4: &'static MyUnsafePack<int> = &STATIC2;
49 unsafe impl<T: Send> Sync for Wrap<T> {}
51 static UNSAFE: MyUnsafePack<int> = MyUnsafePack(UnsafeCell{value: 2});
52 static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack<int>> = Wrap { value: &UNSAFE };