]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-13655.rs
Rollup merge of #92942 - Xaeroxe:raw_arg, r=dtolnay
[rust.git] / src / test / ui / issues / issue-13655.rs
1 // run-pass
2 #![feature(fn_traits, unboxed_closures)]
3 use std::ops::Fn;
4
5 struct Foo<T>(T);
6
7 impl<T: Copy> Fn<()> for Foo<T> {
8     extern "rust-call" fn call(&self, _: ()) -> T {
9       match *self {
10         Foo(t) => t
11       }
12     }
13 }
14
15 impl<T: Copy> FnMut<()> for Foo<T> {
16     extern "rust-call" fn call_mut(&mut self, _: ()) -> T {
17         self.call(())
18     }
19 }
20
21 impl<T: Copy> FnOnce<()> for Foo<T> {
22     type Output = T;
23
24     extern "rust-call" fn call_once(self, _: ()) -> T {
25         self.call(())
26     }
27 }
28
29 fn main() {
30   let t: u8 = 1;
31   println!("{}", Foo(t)());
32 }