rust/compiler
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
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Refactor token collection to capture trailing token immediately 2021-01-22 00:33:03 -05:00
rustc_ast_lowering Rollup merge of #81249 - cjgillot:issue-79537, r=oli-obk 2021-01-23 20:16:07 +01:00
rustc_ast_passes Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
rustc_ast_pretty Remove unused dependency 2021-01-23 10:30:38 +01:00
rustc_attr Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank 2021-01-26 05:47:23 +00:00
rustc_builtin_macros Rollup merge of #80855 - m-ou-se:assert-2021, r=petrochenkov 2021-01-24 22:09:53 +01:00
rustc_codegen_cranelift Use ty::{IntTy,UintTy,FloatTy} in rustc 2021-01-18 21:09:30 +01:00
rustc_codegen_llvm Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_codegen_ssa Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_data_structures Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank 2021-01-26 05:47:23 +00:00
rustc_driver Rollup merge of #80944 - LingMan:map_or, r=nagisa 2021-01-15 18:26:14 +09:00
rustc_error_codes Fix spelling in documentation for error E0207 2021-01-24 20:31:42 +01:00
rustc_errors Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
rustc_expand Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00
rustc_feature Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank 2021-01-26 05:47:23 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #81393 - pnkfelix:issue-81296-make-weak-item-traversal-deterministic, r=estebank 2021-01-27 00:19:45 +00:00
rustc_hir_pretty Add loop head span to hir 2021-01-21 21:41:46 -08:00
rustc_incremental Auto merge of #80957 - tgnottingham:direct_serialize_depgraph, r=michaelwoerister 2021-01-19 19:36:41 +00:00
rustc_index
rustc_infer Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_interface Rollup merge of #81284 - jyn514:impl-times, r=wesleywiser 2021-01-28 15:09:10 +09:00
rustc_lexer
rustc_lint Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_lint_defs Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00
rustc_llvm Use probe-stack=inline-asm in LLVM 11+ 2021-01-14 22:49:16 -05:00
rustc_macros Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
rustc_metadata Check for rmeta crates when getting existing crates from cache 2021-01-26 19:39:24 +01:00
rustc_middle Rollup merge of #81062 - sexxi-goose:precise_capture_diagnostics, r=nikomatsakis 2021-01-28 15:09:06 +09:00
rustc_mir Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_mir_build Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_parse Point only at generic arguments when they are unexpected 2021-01-26 15:59:43 -08:00
rustc_parse_format rustc_parse_format: Fix character indices in find_skips 2021-01-17 17:40:58 +03:00
rustc_passes Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakis 2021-01-28 15:09:02 +09:00
rustc_plugin_impl
rustc_privacy Review changes 2021-01-16 18:56:37 -05:00
rustc_query_system Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank 2021-01-26 05:47:23 +00:00
rustc_resolve Add SEMICOLON_IN_EXPRESSIONS_FROM_MACROS lint 2021-01-28 08:51:43 -05:00
rustc_save_analysis Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-14 19:23:59 +01:00
rustc_serialize rustc_serialize: fix incorrect signed LEB128 decoding 2021-01-11 12:13:26 -08:00
rustc_session Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank 2021-01-26 05:47:23 +00:00
rustc_span Rollup merge of #81277 - flip1995:from_diag_items, r=matthewjasper 2021-01-28 15:09:08 +09:00
rustc_symbol_mangling Use ty::{IntTy,UintTy,FloatTy} in rustc 2021-01-18 21:09:30 +01:00
rustc_target Auto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper 2021-01-24 09:44:42 +00:00
rustc_trait_selection Rollup merge of #81426 - BoxyUwU:boxychangesv2, r=oli-obk 2021-01-28 15:09:15 +09:00
rustc_traits Use ty::{IntTy,UintTy,FloatTy} in rustc 2021-01-18 21:09:30 +01:00
rustc_ty_utils Infallible version of def_span. 2021-01-23 13:35:22 +01:00
rustc_type_ir Move a few more types to rustc_type_ir 2021-01-18 21:06:12 +01:00
rustc_typeck Rollup merge of #81433 - lcnr:stop-looking-into-ty-alias, r=oli-obk 2021-01-28 15:09:20 +09:00