Skip to content

Expand on lints with macro spans. #544

Open
@ehuss

Description

@ehuss

Lints behave a little strange with macros, particularly from external crates. This should probably be captured somewhere, probably the diagnostics page for allow/warn/deny/forbid.

For example, lints generated on items created by an extern macro do not fire. Calling the following will not trigger a (deny by default) lint:

#[macro_export]
macro_rules! thing {
    () => {
        #[no_mangle]
        pub const FOO: i32 = 5;
    }
}

See also rust-lang/rust#58502 where the ident comes from the local crate, but does not pick up the global lint level of the extern crate.

So I imagine there are a variety of things to consider (the location of a span, the lint level of the local and extern crates, etc.). I don't know where to begin distilling how things work. Perhaps it is not as complex as it appears. I also get the impression that it depends on exactly which lint it is, since some are done at different phases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions