rust/compiler/rustc_resolve/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
..
late Avoid emitting redundant "unused label" lint 2021-01-21 21:41:46 -08:00
build_reduced_graph.rs resolve: Simplify collection of traits in scope 2021-01-11 23:49:47 +03:00
check_unused.rs Attach TokenStream to ast::Visibility 2020-09-10 17:33:06 -04:00
def_collector.rs resolve/expand: Improve attribute expansion on macro definitions and calls 2021-01-09 18:43:01 +03:00
diagnostics.rs resolve: Reject ambiguity built-in attr vs different built-in attr 2021-01-17 01:48:17 +03:00
imports.rs Move lev_distance to rustc_ast, make non-generic 2020-11-24 16:12:23 -08:00
late.rs Fix clippy and comment 2021-01-21 21:43:28 -08:00
lib.rs Add more self-profile info to rustc_resolve 2021-01-21 18:15:17 -05:00
macros.rs Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00