Closed
Description
A blank project with the following main.rs
:
trait Trait {
type Associated;
}
struct Struct;
impl Trait for Struct {
type Associated = u8;
}
fn f() -> impl Fn(<Struct as Trait>::Associated) {
// All of the following produce more or less the same error:
//loop {}
//unimplemented!()
//panic!()
//|_: <Struct as Trait>::Associated| {}
//|_: u8| {}
|_| {}
}
fn main() {}
Produces the following error:
Checking rust9 v0.1.0 (/home/carado/tmp/rust9)
error[E0631]: type mismatch in closure arguments
--> src/main.rs:11:11
|
11 | fn f() -> impl Fn(<Struct as Trait>::Associated) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected signature of `fn(<Struct as Trait>::Associated) -> _`
...
18 | |_| {}
| --- found signature of `fn(u8) -> _`
|
= note: the return type of a function must have a statically known size
error: aborting due to previous error
error: Could not compile `rust9`.
To learn more, run the command again with --verbose.