rust/src/test/ui/issues/issue-51154.rs
David Wood 01f65afa4a
diag: improve closure/generic parameter mismatch
This commit improves the diagnostic when a type parameter is expected
and a closure is found, noting that each closure has a distinct type and
therefore could not always match the caller-chosen type of the
parameter.

Signed-off-by: David Wood <david@davidtw.co>
2020-09-14 15:21:38 +01:00

6 lines
108 B
Rust

fn foo<F: FnMut()>() {
let _: Box<F> = Box::new(|| ());
//~^ ERROR mismatched types
}
fn main() {}