Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created October 29, 2017 20:02
Show Gist options
  • Save nikomatsakis/a516dbc1c89010ce8557a290b5619934 to your computer and use it in GitHub Desktop.
Save nikomatsakis/a516dbc1c89010ce8557a290b5619934 to your computer and use it in GitHub Desktop.
// This program:
#![feature(conservative_impl_trait)]
use std::fmt::Debug;
#[derive(Debug)]
struct Foo<'a> { x: &'a i32 }
unsafe impl Send for Foo<'static> { }
fn foo<'a>(x: &'a i32) -> impl Debug + 'a {
Foo { x }
}
fn bar() {
let mut x = 5;
x += 5;
let y = || foo(&x);
is_send(y());
}
fn is_send<T: Send>(_t: T) { }
fn main() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment