Skip to content

Private enum variant reexport error emits an error per each variant #46209

Closed
@estebank

Description

@estebank

When trying to reexport the variants of a private enum, a diagnostic is emitted for each variant pointing always at the same reexport span, making it too verbose:

error: variant `Variant1` is private, and cannot be reexported, consider declaring its enum as `pub`
  --> file.rs:12:9
   |
12 | pub use self::Enum::*;
   |         ^^^^^^^^^^^^^
(...)
error: variant `VariantN` is private, and cannot be reexported, consider declaring its enum as `pub`
  --> file.rs:12:9
   |
12 | pub use self::Enum::*;
   |         ^^^^^^^^^^^^^

Ideally there would be only one diagnostic emitted, with an extra span pointing at the definition of Enum to suggest making it public.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions