]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-14959.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-14959.rs
CommitLineData
d9bb1a4e 1// check-pass
c34b1796
AL
2// pretty-expanded FIXME #23616
3
92a42be0 4#![feature(fn_traits, unboxed_closures)]
1a4d82fc
JJ
5
6use std::ops::Fn;
7
85aaf69f
SL
8trait Response { fn dummy(&self) { } }
9trait Request { fn dummy(&self) { } }
1a4d82fc
JJ
10trait Ingot<R, S> {
11 fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status;
12}
13
14#[allow(dead_code)]
15struct HelloWorld;
16
85aaf69f 17struct SendFile;
1a4d82fc
JJ
18struct Alloy;
19enum Status {
20 Continue
21}
22
23impl Alloy {
24 fn find<T>(&self) -> Option<T> {
25 None
26 }
27}
28
dc9dc135
XL
29impl<'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
33impl<'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 39impl<'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
47impl<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
55fn main() {}