Created
September 27, 2016 20:48
-
-
Save anonymous/250304e126a97977db857b2833dc5b85 to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains hidden or 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
#![feature(unboxed_closures)] | |
#![feature(fn_traits)] | |
#[derive(Clone)] | |
struct Foo (i32); | |
type Bar = i32; | |
impl Foo { | |
fn go(&self, _: &i32) { } | |
} | |
fn _ice() { | |
let a = vec![].into_iter(); | |
let _ = a.map(Foo(1).clone()); | |
} | |
impl FnOnce<(Bar,)> for Foo { | |
type Output = (); | |
extern "rust-call" fn call_once(self, (args,): (Bar,)) -> Self::Output { | |
self.go(&args) | |
} | |
} | |
impl FnMut<(Bar,)> for Foo { | |
extern "rust-call" fn call_mut(&mut self, (args,): (Bar,)) -> Self::Output { | |
self.go(&args) | |
} | |
} | |
impl FnOnce<Bar> for Foo { | |
type Output = (); | |
extern "rust-call" fn call_once(self, args: Bar) -> Self::Output { | |
self.go(&args) | |
} | |
} | |
impl FnMut<Bar> for Foo { | |
extern "rust-call" fn call_mut(&mut self, args: Bar) -> Self::Output { | |
self.go(&args) | |
} | |
} | |
fn main() { | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment