2019-11-04 00:00:00 +00:00
|
|
|
// check-pass
|
2015-03-22 20:13:15 +00:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-12-03 01:31:49 +00:00
|
|
|
#![feature(fn_traits, unboxed_closures)]
|
2014-06-17 18:14:06 +00:00
|
|
|
|
|
|
|
use std::ops::Fn;
|
|
|
|
|
2015-02-12 15:29:52 +00:00
|
|
|
trait Response { fn dummy(&self) { } }
|
|
|
|
trait Request { fn dummy(&self) { } }
|
2014-06-17 18:14:06 +00:00
|
|
|
trait Ingot<R, S> {
|
|
|
|
fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
struct HelloWorld;
|
|
|
|
|
2015-02-12 15:29:52 +00:00
|
|
|
struct SendFile;
|
2014-06-17 18:14:06 +00:00
|
|
|
struct Alloy;
|
|
|
|
enum Status {
|
|
|
|
Continue
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Alloy {
|
|
|
|
fn find<T>(&self) -> Option<T> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
impl<'b> Fn<(&'b mut (dyn Response + 'b),)> for SendFile {
|
|
|
|
extern "rust-call" fn call(&self, (_res,): (&'b mut (dyn Response + 'b),)) {}
|
2015-03-11 14:08:33 +00:00
|
|
|
}
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
impl<'b> FnMut<(&'b mut (dyn Response + 'b),)> for SendFile {
|
|
|
|
extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (dyn Response+'b),)) {
|
2015-03-11 14:08:33 +00:00
|
|
|
self.call((_res,))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
impl<'b> FnOnce<(&'b mut (dyn Response + 'b),)> for SendFile {
|
2015-01-12 15:27:25 +00:00
|
|
|
type Output = ();
|
|
|
|
|
2019-05-28 18:46:13 +00:00
|
|
|
extern "rust-call" fn call_once(self, (_res,): (&'b mut (dyn Response+'b),)) {
|
2015-03-11 14:08:33 +00:00
|
|
|
self.call((_res,))
|
|
|
|
}
|
2014-06-17 18:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2014-11-06 08:05:53 +00:00
|
|
|
Status::Continue
|
2014-06-17 18:14:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|