-
Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleF-on_unimplementedError messages that can be tackled with `#[rustc_on_unimplemented]`Error messages that can be tackled with `#[rustc_on_unimplemented]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleF-on_unimplementedError messages that can be tackled with `#[rustc_on_unimplemented]`Error messages that can be tackled with `#[rustc_on_unimplemented]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.