Open
Description
openedon Jul 11, 2019
fn main() {
let new_service = {
hyper::service::service_fn_ok(unimplemented!())
};
hyper::Server::bind(unimplemented!())
.serve(new_service);
}
Compiler error:
error[E0277]: expected a `std::ops::Fn<()>` closure, found `hyper::service::service::ServiceFnOk<_, _>`
--> src/main.rs:6:10
|
6 | .serve(new_service);
| ^^^^^ expected an `Fn<()>` closure, found `hyper::service::service::ServiceFnOk<_, _>`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `hyper::service::service::ServiceFnOk<_, _>`
= note: wrap the `hyper::service::service::ServiceFnOk<_, _>` in a closure with no arguments: `|| { /* code */ }
= note: required because of the requirements on the impl of `hyper::service::new_service::NewService` for `hyper::service::service::ServiceFnOk<_, _>`
= note: required because of the requirements on the impl of `hyper::service::make_service::MakeServiceRef<hyper::server::tcp::addr_stream::AddrStream>` for `hyper::service::service::ServiceFnOk<_, _>`
I think it's better to improve this note
= note: wrap the `hyper::service::service::ServiceFnOk<_, _>` in a closure with no arguments: `|| { /* code */ }
So it's more noticeable and readable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Error messages that can be tackled with `#[rustc_on_unimplemented]`Relevant to the compiler team, which will review and decide on the PR/issue.