]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issue-17718-static-unsafe-interior.rs
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 // pretty-expanded FIXME #23616
18 use std
::cell
::UnsafeCell
;
20 struct MyUnsafePack
<T
>(UnsafeCell
<T
>);
22 unsafe impl<T
: Send
> Sync
for MyUnsafePack
<T
> {}
25 value
: MyUnsafePack
<T
>
29 fn forbidden(&self) {}
32 unsafe impl<T
: Send
> Sync
for MyUnsafe
<T
> {}
36 VariantUnsafe(UnsafeCell
<T
>)
39 unsafe impl<T
: Send
> Sync
for UnsafeEnum
<T
> {}
41 static STATIC1
: UnsafeEnum
<isize> = UnsafeEnum
::VariantSafe
;
43 static STATIC2
: MyUnsafePack
<isize> = MyUnsafePack(UnsafeCell
::new(1));
44 const CONST
: MyUnsafePack
<isize> = MyUnsafePack(UnsafeCell
::new(1));
45 static STATIC3
: MyUnsafe
<isize> = MyUnsafe{value: CONST}
;
47 static STATIC4
: &'
static MyUnsafePack
<isize> = &STATIC2
;
53 unsafe impl<T
: Send
> Sync
for Wrap
<T
> {}
55 static UNSAFE
: MyUnsafePack
<isize> = MyUnsafePack(UnsafeCell
::new(2));
56 static WRAPPED_UNSAFE
: Wrap
<&'
static MyUnsafePack
<isize>> = Wrap { value: &UNSAFE }
;