]>
Commit | Line | Data |
---|---|---|
d9bb1a4e | 1 | // check-pass |
c34b1796 AL |
2 | // pretty-expanded FIXME #23616 |
3 | ||
92a42be0 | 4 | #![feature(fn_traits, unboxed_closures)] |
1a4d82fc JJ |
5 | |
6 | use std::ops::Fn; | |
7 | ||
85aaf69f SL |
8 | trait Response { fn dummy(&self) { } } |
9 | trait Request { fn dummy(&self) { } } | |
1a4d82fc JJ |
10 | trait Ingot<R, S> { |
11 | fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; | |
12 | } | |
13 | ||
14 | #[allow(dead_code)] | |
15 | struct HelloWorld; | |
16 | ||
85aaf69f | 17 | struct SendFile; |
1a4d82fc JJ |
18 | struct Alloy; |
19 | enum Status { | |
20 | Continue | |
21 | } | |
22 | ||
23 | impl Alloy { | |
24 | fn find<T>(&self) -> Option<T> { | |
25 | None | |
26 | } | |
27 | } | |
28 | ||
dc9dc135 XL |
29 | impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile { |
30 | extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {} | |
c34b1796 AL |
31 | } |
32 | ||
dc9dc135 XL |
33 | impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile { |
34 | extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) { | |
c34b1796 AL |
35 | self.call((_res,)) |
36 | } | |
37 | } | |
38 | ||
dc9dc135 | 39 | impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile { |
85aaf69f SL |
40 | type Output = (); |
41 | ||
dc9dc135 | 42 | extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) { |
c34b1796 AL |
43 | self.call((_res,)) |
44 | } | |
1a4d82fc JJ |
45 | } |
46 | ||
47 | impl<Rq: Request, Rs: Response> Ingot<Rq, Rs> for HelloWorld { | |
48 | fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { | |
49 | let send_file = alloy.find::<SendFile>().unwrap(); | |
50 | send_file(res); | |
51 | Status::Continue | |
52 | } | |
53 | } | |
54 | ||
55 | fn main() {} |