Closed
Description
I assumed that the following code would be legal, as it does not require indefinitely sized types, but apparently somewhere the existential type is revealed too early:
#![feature(existential_type)]
existential type Foo: Fn() -> Foo;
fn foo() -> Foo {
foo
}
fn main() {
}
Errors:
Compiling playground v0.0.1 (file:///playground)
error[E0271]: type mismatch resolving `<fn() -> Foo {foo} as std::ops::FnOnce<()>>::Output == fn() -> Foo {foo}`
--> src/main.rs:3:1
|
3 | existential type Foo: Fn() -> Foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected anonymized type, found fn item
|
= note: expected type `Foo`
found type `fn() -> Foo {foo}`
= note: the return type of a function must have a statically known size
error: aborting due to previous error
For more information about this error, try `rustc --explain E0271`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done