Skip to content

"expected the unit value ()" formatting bug in Nightly #44760

Closed
@iitalics

Description

@iitalics

playground

The code:

struct Thing;
impl Thing {
    fn takes_unit(&self, u: ()) { u }

    fn func(&self) {
        self.takes_unit()
    }
}

Produces a malformed "help" message:

  |
3 |     fn takes_unit(&self, u: ()) { u }
  |     --------------------------------- defined here
...
6 |         self.takes_unit()
  |              ^^^^^^^^^^
  |
help: expected the unit value `()`. You can create one with a pair of parenthesis
  |
6 |         self.takes_uni()t()
  |                       ^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-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