summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-14959.rs
blob: e31a9431558f6964d2e620d9f5a69ecd573063a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// check-pass
// pretty-expanded FIXME #23616

#![feature(fn_traits, unboxed_closures)]

use std::ops::Fn;

trait Response { fn dummy(&self) { } }
trait Request { fn dummy(&self) { } }
trait Ingot<R, S> {
    fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status;
}

#[allow(dead_code)]
struct HelloWorld;

struct SendFile;
struct Alloy;
enum Status {
    Continue
}

impl Alloy {
    fn find<T>(&self) -> Option<T> {
        None
    }
}

impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile {
    extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {}
}

impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile {
    extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) {
        self.call((_res,))
    }
}

impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile {
    type Output = ();

    extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) {
        self.call((_res,))
    }
}

impl<Rq: Request, Rs: Response> Ingot<Rq, Rs> for HelloWorld {
    fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status {
        let send_file = alloy.find::<SendFile>().unwrap();
        send_file(res);
        Status::Continue
    }
}

fn main() {}