Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created April 27, 2018 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/735efd9e0a3a371acec06e66be3e8798 to your computer and use it in GitHub Desktop.
Save rust-play/735efd9e0a3a371acec06e66be3e8798 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
fn assert_copy<C: Copy>(_: C) {}
fn assert_fn<F: Fn()>(_: F) {}
struct Opaque(());
fn main() {
let o = Opaque(());
let f = move || { &o; };
assert_copy(f);
assert_fn(f);
drop(f);
drop(o);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment