rust/compiler/rustc_expand/src/mbe
Aaron Hill f9025512e7
Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint
cc #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.
2021-01-28 08:51:43 -05:00
..
macro_check.rs Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
macro_parser.rs Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
macro_rules.rs Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00
quoted.rs Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
transcribe.rs rustc_ast: visit_mac -> visit_mac_call 2020-11-03 23:39:51 +03:00