Closed
Description
class foo {
let x: ();
new() {
fail;
}
}
This shouldn't error with 'field is never initialized'.
The real use case for this is of the form:
new() {
res = some_operation();
if res.is_err() {
fail "This is a specific and helpful error message about the failure of some_operation().";
} else {
some_local = res.get();
}
}
This can be worked around by initializing some_local to a placeholder value, but the type of some_local may not provide a convenient one. It can also be worked around in this specific case by not casing, and just setting some_local = res.get(), at the cost of a less useful error message.
Metadata
Metadata
Assignees
Labels
No labels