Skip to content

Macros can not parse and expand to associated types #22463

Closed
@Kimundi

Description

@Kimundi
macro_rules! items {
    () => {
        type A = ();
        fn a() {}
    }
}

trait Foo {
    type A;
    fn a();
}

impl Foo for () {
    items!();
}

fn main() {

}
<anon>:3:9: 3:13 error: expected one of `extern`, `fn`, or `unsafe`, found `type`
<anon>:3         type A = ();
                 ^~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions