Closed
Description
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=cedda74405870f1697d8323ea0fa041d
fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) {
todo!();
}
fn main() {
let v = true;
foo(move |x| v);
}
The current output is:
error[[E0631]](https://doc.rust-lang.org/stable/error-index.html#E0631): type mismatch in closure arguments
--> src/main.rs:7:5
|
7 | foo(move |x| v);
| ^^^ ---------- found signature of `for<'r> fn(&'r char) -> _`
| |
| expected signature of `fn(char) -> _`
|
note: required by a bound in `foo`
--> src/main.rs:1:31
|
1 | fn foo<F: Fn(&char) -> bool + Fn(char) -> bool>(f: F) {
| ^^^^^^^^^^^^^^^^ required by this bound in `foo`
Ideally the output should look like:
We don't have a specific output in mind, but it'd be nice if the error helpfully specified that this bound is impossible to satisfy with a closure. However, we do acknowledge that Fn
traits (specifically, implementing them) are still unstable.