Skip to content

"expecting a type here because of type ascription" when forgetting a : #51222

Closed
@progval

Description

@progval

In the following code, I forgot a semicolon:

fn main() {
    Box:new("foo".to_string())
}

This generates the following error:

  |
2 |     Box:new("foo".to_string())
  |             ^^^^^ expecting a type here because of type ascription

This may get confusing when nesting multiple calls in the argument of Box::new.

ping @GuillaumeGomez

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions