Skip to content

Consider turning "visibility has no effect inside functions" into a lint #31776

Closed
@sgrif

Description

@sgrif

The current code results in a hard error:

fn main() {
    pub struct foo;
}

This can be painful when writing macros that generate structs or inherent methods, which would otherwise need to be public (particularly when writing tests for those macros). This doesn't seem like something which should need to be an error, and could instead be a lint (which is deny by default). I'm unsure if this would need a full RFC or not, and was told that it'd be best to open an issue to start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.P-mediumMedium priorityT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions