Skip to content

#[component] cannot handle empty struct types #7

@sassman

Description

@sassman

this works:

#[component]
struct SpecificDuck {}

this does not work:

#[component]
struct SpecificDuck;

the error is:

error[E0618]: expected function, found struct `SpecificDuck`
  --> examples/01-waiter-di.rs:11:8
   |
10 | #[component]
   | ------------ call expression requires function
11 | struct SpecificDuck;
   | -------^^^^^^^^^^^^
   | |
   | struct `SpecificDuck` defined here
   |
help: `SpecificDuck` is a unit struct, and does not take parentheses to be constructed
   |
10 - #[component]
10 + #[component]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions