Skip to content

better error message when there is a missing semicolon with an expression #1481

Closed
@nikomatsakis

Description

@nikomatsakis

Something like:

fn foo() {
    task::spawn {|| } //! ERROR type mismatch: expected '()' but got 'tast'
    bar();
}

fn bar() {
}

will yield an error something like the one above. It would be better if it said, "statement with non-unit return type requires a semicolon" or something like that. This would be easy-ish to fix: the ast has a type "stmt_expr" and "stmt_semi", and "stmt_expr" must have a unit type.

Metadata

Metadata

Assignees

Labels

A-type-systemArea: Type systemE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions