rust/compiler/rustc_expand/src
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
..
mbe Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00
mut_visit
parse Force token collection to run when parsing nonterminals 2021-01-20 18:09:32 -05:00
tokenstream
base.rs Make -Z time-passes less noisy 2021-01-23 11:44:46 -05:00
build.rs
config.rs Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
expand.rs Rollup merge of #81284 - jyn514:impl-times, r=wesleywiser 2021-01-28 15:09:10 +09:00
lib.rs
mbe.rs Revert "Promote missing_fragment_specifier to hard error" 2020-12-22 09:33:16 -05:00
module.rs
placeholders.rs resolve/expand: Improve attribute expansion on macro definitions and calls 2021-01-09 18:43:01 +03:00
proc_macro_server.rs rustc_parse: Better spans for synthesized token streams 2021-01-07 17:48:13 +03:00
proc_macro.rs Force token collection to run when parsing nonterminals 2021-01-20 18:09:32 -05:00
tests.rs remove redundant closures (clippy::redundant_closure) 2021-01-03 13:34:24 +01:00