-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.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
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.
Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.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.