Created
January 17, 2019 02:42
-
-
Save rust-play/89817f8251e78f2c1512d473377222f6 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![stable(feature = "playground", since = "0.0.0")] | |
#![feature(const_fn, staged_api)] | |
#![allow(dead_code)] | |
use core::marker::PhantomData; | |
#[stable(feature = "iter_empty", since = "1.2.0")] | |
pub struct Empty<T: 'static>(PhantomData<&'static T>); | |
impl<T> Empty<T> { | |
#[stable(feature = "iter_empty", since = "1.2.0")] | |
pub const fn new() -> Self { | |
Empty(PhantomData) | |
} | |
} | |
fn covariant<'a>(empty: Empty<&'static u8>) -> Empty<&'a u8> { | |
empty | |
} | |
fn main() { | |
fn assert_send_and_sync<T: Send + Sync>() {} | |
let _ = assert_send_and_sync::<Empty<*mut u8>>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment