Currently in case of a Trait object in closure parameter, the compiler suggests either to use a reference, which is correct or to use an `impl Trait` which is not. Do not emit this suggestion when the parameter is part of a closure.
6 lines
230 B
Rust
6 lines
230 B
Rust
// Suggestion to use impl trait in closure parameter is invalid, see issue 138932
|
|
fn main() {
|
|
let c = |f: dyn Fn()| f();
|
|
//~^ ERROR: the size for values of type `(dyn Fn() + 'static)` cannot be known at compilation time
|
|
}
|