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

Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint #79819

Merged
merged 1 commit into from
Jan 29, 2021

Commits on Jan 28, 2021

  1. Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint

    cc rust-lang#79813
    
    This PR adds an allow-by-default future-compatibility lint
    `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS`. It fires when a trailing semicolon in a
    macro body is ignored due to the macro being used in expression
    position:
    
    ```rust
    macro_rules! foo {
        () => {
            true; // WARN
        }
    }
    
    fn main() {
        let val = match true {
            true => false,
            _ => foo!()
        };
    }
    ```
    
    The lint takes its level from the macro call site, and
    can be allowed for a particular macro by adding
    `#[allow(semicolon_in_expressions_from_macros)]`.
    
    The lint is set to warn for all internal rustc crates (when being built
    by a stage1 compiler). After the next beta bump, we can enable
    the lint for the bootstrap compiler as well.
    Aaron1011 committed Jan 28, 2021
    Configuration menu
    Copy the full SHA
    f902551 View commit details
    Browse the repository at this point in the history