// Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // pretty-expanded FIXME #23616 #![feature(core)] use std::marker; use std::cell::UnsafeCell; struct MyUnsafePack(UnsafeCell); unsafe impl Sync for MyUnsafePack {} struct MyUnsafe { value: MyUnsafePack } impl MyUnsafe { fn forbidden(&self) {} } unsafe impl Sync for MyUnsafe {} enum UnsafeEnum { VariantSafe, VariantUnsafe(UnsafeCell) } unsafe impl Sync for UnsafeEnum {} static STATIC1: UnsafeEnum = UnsafeEnum::VariantSafe; static STATIC2: MyUnsafePack = MyUnsafePack(UnsafeCell { value: 1 }); const CONST: MyUnsafePack = MyUnsafePack(UnsafeCell { value: 1 }); static STATIC3: MyUnsafe = MyUnsafe{value: CONST}; static STATIC4: &'static MyUnsafePack = &STATIC2; struct Wrap { value: T } unsafe impl Sync for Wrap {} static UNSAFE: MyUnsafePack = MyUnsafePack(UnsafeCell{value: 2}); static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack> = Wrap { value: &UNSAFE }; fn main() { let a = &STATIC1; STATIC3.forbidden() }