-
-
Save anka-213/7cca739c95a0942ed448931f6e5406dc to your computer and use it in GitHub Desktop.
Shared via 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
#![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