Skip to content

#[actor] macro does not support generic structs #272

@LeonMatthesKDAB

Description

@LeonMatthesKDAB

Expected Behavior

Adding #[actor] onto a generic struct should work or otherwise provide a descriptive error message.

e.g.:

#[actor]
struct MyActor<A> {
    client: A
}

Actual Behavior

The compiler generates a (somewhat confusing) error message:

error[E0107]: missing generics for struct `MyActor`
  --> src/actor/mod.rs:62:8
   |
62 | struct MyActor<A> {
   |        ^^^^^^^ expected 1 generic argument
   |
note: struct defined here, with 1 generic parameter: `A`
  --> src/actor/mod.rs:62:8
   |
62 | struct MyActor<A> {
   |        ^^^^^^^ -
help: add missing generic argument
   |
62 | struct MyActor<A><A> {
   |               +++

Steps to Reproduce the Problem

On version 0.16, use the #[actor] macro on a generic struct:

#[actor]
struct MyActor<A> {
    client: A
}

Then try to compile the code.

Release Note

RELEASE NOTE:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions