Skip to content

self in expanded macro erroneously talks about static methods #32792

Closed
@TimNN

Description

@TimNN

The following code (playpen):

macro_rules! slf { () => (self;) }

struct Foo;

impl Foo {
    fn bar(self) {
        slf!();
    }
}

causes the error:

`self` is not available in a static method. Maybe a `self` argument is missing?

which is obviously incorrect (and probably caused by a specialized error message if self is an unknown identifier, I would imagine).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions