Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow #[deny] inside #[forbid] as a no-op with a warning #121560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 24, 2024

  1. Allow #[deny] inside #[forbid] as a no-op with a warning

    Forbid cannot be overriden. When someome tries to do this anyways,
    it results in a hard error. That makes sense.
    
    Except it doesn't, because macros. Macros may reasonably use `#[deny]`
    (or `#[warn]` for an allow-by-default lint) in their expansion to assert
    that their expanded code follows the lint. This is doesn't work when the
    output gets expanded into a `forbid()` context. This is pretty silly,
    since both the macros and the code agree on the lint!
    
    By making it a warning instead, we remove the problem with the macro,
    which is now nothing as warnings are suppressed in macro expanded code,
    while still telling users that something is up.
    Nilstrieb committed Feb 24, 2024
    Copy the full SHA
    e8b5368 View commit details
    Browse the repository at this point in the history