Skip to content

Allow deny/forbid level lints in macros to cross crate boundaries #67720

@nvzqz

Description

@nvzqz

I'm attempting to add an assert_ffi_safe! macro to static_assertions by creating an extern "C" block with a function that references the input types and marking it with #[forbid(improper_ctypes)] (see nvzqz/static-assertions#31). However, while the macro works correctly if used within the same crate, it results in false positives when used externally. This is evidenced by compile_fail doc tests passing.

I imagine that rustc lints are disabled when calling into a macro that is not defined within the calling crate so that they don't become a nuisance to consumers who have no control over the code within the macro. This is a case where ensuring that lints work across crate boundaries would be beneficial.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-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