]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-14959.rs
Auto merge of #57108 - Mark-Simulacrum:license-remove, r=pietroalbini
[rust.git] / src / test / ui / issues / issue-14959.rs
1 // compile-pass
2 // pretty-expanded FIXME #23616
3
4 #![feature(fn_traits, unboxed_closures)]
5
6 use std::ops::Fn;
7
8 trait Response { fn dummy(&self) { } }
9 trait Request { fn dummy(&self) { } }
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
17 struct SendFile;
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
29 impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile {
30     extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {}
31 }
32
33 impl<'b> FnMut<(&'b mut (Response+'b),)> for SendFile {
34     extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (Response+'b),)) {
35         self.call((_res,))
36     }
37 }
38
39 impl<'b> FnOnce<(&'b mut (Response+'b),)> for SendFile {
40     type Output = ();
41
42     extern "rust-call" fn call_once(self, (_res,): (&'b mut (Response+'b),)) {
43         self.call((_res,))
44     }
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() {}