Skip to content

Confusing error message: "can't qualify macro invocation with pub" when struct keyword missing #55403

Closed
@jimblandy

Description

@jimblandy

The program:

pub LexicalEnv<'a>

elicits the confusing error message:

error: can't qualify macro invocation with `pub`
 --> src/lib.rs:1:1
  |
1 | pub LexicalEnv<'a>
  | ^^^
  |
  = help: try adjusting the macro to put `pub` inside the invocation

error: expected one of `!` or `::`, found `<`
 --> src/lib.rs:1:15
  |
1 | pub LexicalEnv<'a>
  |               ^ expected one of `!` or `::` here

Similar issues have been filed before (#40006 and #38911, at least), and were not closed with an indication that the problem wasn't expected to be fixed, so I'm going ahead and filing this. This specific case was mentioned in a comment by @fschutt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions