Closed
Description
The following code compiles, since the return type is inferred to be Option<()>
:
fn main() {
Some(5).map(|_| ());
}
However, this will not compile because rustc
cannot infer a type:
fn main() {
Some(5).map(|_| fail!());
}
If we used something like Void
instead of !
, the return type would obviously be Option<Void>
here. However, since !
isn't allowed anywhere but a function signature this is a pain.
Metadata
Metadata
Assignees
Labels
No labels