rust/compiler
Michael Goulet 9d4527bc80
Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholk
Consider lint check attributes on match arms

Currently, lint check attributes on match arms have no effect for some lints. This PR makes some lint passes to take those attributes into account.

- `LateContextAndPass` for late lint doesn't update `last_node_with_lint_attrs` when it visits match arms. This leads to lint check attributes on match arms taking no effects on late lints that operate on the arms' pattern:

  ```rust
  match value {
      #[deny(non_snake_case)]
      PAT => {} // `non_snake_case` only warned due to default lint level
  }
  ```

  To be honest, I'm not sure whether this is intentional or just an oversight. I've dug the implementation history and searched up issues/PRs but couldn't find any discussion on this.

- `MatchVisitor` doesn't update its lint level when it visits match arms. This leads to check lint attributes on match arms taking no effect on some lints handled by this visitor, namely: `bindings_with_variant_name` and `irrefutable_let_patterns`.

  This seems to be a fallout from #108504. Before 05082f57af, when the visitor operated on HIR rather than THIR, check lint attributes for the said lints were effective. [This playground][play] compiles successfully on current stable (1.69) but fails on current beta and nightly.

  I wasn't sure where best to place the test for this. Let me know if there's a better place.

[play]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=38432b79e535cb175f8f7d6d236d29c3
[play-match]: https://play.rust-lang.org/?version=beta&mode=debug&edition=2021&gist=629aa71b7c84b269beadeba664e2221d
2023-05-25 13:58:00 -07:00
..
rustc
rustc_abi Avoid &format("...") calls in error message code. 2023-05-16 17:59:56 +10:00
rustc_apfloat
rustc_arena Deny the unsafe_op_in_unsafe_fn lint in 2023-04-28 21:00:54 -07:00
rustc_ast Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_ast_lowering Turn debugger_visualizers from feed- into regular query. 2023-05-16 18:50:36 +02:00
rustc_ast_passes Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_ast_pretty Migrate offset_of from a macro to builtin # syntax 2023-05-05 21:44:13 +02:00
rustc_attr Only depend on CFG_VERSION in rustc_interface 2023-05-17 23:54:21 -05:00
rustc_baked_icu_data Regen baked data 2023-05-02 10:45:16 -07:00
rustc_borrowck Add InferCtxt::register_hidden_type_in_new_solver 2023-05-25 03:35:14 +00:00
rustc_builtin_macros Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_codegen_cranelift Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_codegen_gcc Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_codegen_llvm Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_codegen_ssa Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_const_eval Move DefiningAnchor 2023-05-25 03:21:21 +00:00
rustc_data_structures Rollup merge of #111875 - WaffleLapkin:defer_on_drop, r=Nilstrieb 2023-05-25 08:01:08 +02:00
rustc_driver
rustc_driver_impl Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_error_codes Rollup merge of #111215 - BoxyUwU:resolve_anon_consts_differently, r=cjgillot 2023-05-09 20:49:32 +02:00
rustc_error_messages correct literals for dyn thread safe 2023-05-06 09:34:53 +08:00
rustc_errors Use is_some_and/is_ok_and in less obvious spots 2023-05-24 14:33:43 +00:00
rustc_expand Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_feature Use is_some_and/is_ok_and in less obvious spots 2023-05-24 14:33:43 +00:00
rustc_fluent_macro Remove unused synstructure dep 2023-04-22 22:03:33 +01:00
rustc_fs_util
rustc_graphviz enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
rustc_hir Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_hir_analysis Move DefiningAnchor 2023-05-25 03:21:21 +00:00
rustc_hir_pretty Rip it out 2023-05-01 16:15:13 +08:00
rustc_hir_typeck Move DefiningAnchor 2023-05-25 03:21:21 +00:00
rustc_incremental Only depend on CFG_VERSION in rustc_interface 2023-05-17 23:54:21 -05:00
rustc_index Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_infer Add InferCtxt::register_hidden_type_in_new_solver 2023-05-25 03:35:14 +00:00
rustc_interface Don't leak the function that is called on drop 2023-05-23 14:53:36 +00:00
rustc_lexer Don't try to eat non-existent decimal digits. 2023-05-15 18:33:12 +10:00
rustc_lint Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholk 2023-05-25 13:58:00 -07:00
rustc_lint_defs Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, r=Mark-Simulacrum 2023-05-08 04:50:28 +00:00
rustc_llvm Auto merge of #111364 - cuviper:unhack-thinlto, r=nikic 2023-05-18 01:35:41 +00:00
rustc_log Stabilize IsTerminal 2023-04-10 17:24:23 +09:00
rustc_macros Merge query property modules into one 2023-05-18 09:45:12 +02:00
rustc_metadata Auto merge of #86844 - bjorn3:global_alloc_improvements, r=pnkfelix 2023-05-25 16:59:57 +00:00
rustc_middle Auto merge of #111473 - compiler-errors:opaques, r=lcnr 2023-05-25 08:41:54 +00:00
rustc_mir_build Rollup merge of #111757 - lowr:fix/lint-attr-on-match-arm, r=eholk 2023-05-25 13:58:00 -07:00
rustc_mir_dataflow Rollup merge of #110930 - b-naber:normalize-elaborate-drops, r=cjgillot 2023-05-17 19:11:53 +05:30
rustc_mir_transform Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_monomorphize Improve CGU partitioning debug output. 2023-05-19 08:48:28 +10:00
rustc_parse Use is_some_and/is_ok_and in less obvious spots 2023-05-24 14:33:43 +00:00
rustc_parse_format Fix typos in compiler 2023-04-10 22:02:52 +02:00
rustc_passes Use is_some_and/is_ok_and in less obvious spots 2023-05-24 14:33:43 +00:00
rustc_plugin_impl Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
rustc_privacy rustc_privacy: Reach underlying types of impl Traits in a separate pass 2023-05-22 19:59:38 +03:00
rustc_query_impl Add comment 2023-05-21 11:25:07 +02:00
rustc_query_system Rollup merge of #111875 - WaffleLapkin:defer_on_drop, r=Nilstrieb 2023-05-25 08:01:08 +02:00
rustc_resolve Rollup merge of #111152 - lukas-code:markdown-parsers-are-hard, r=GuillaumeGomez 2023-05-25 13:57:59 -07:00
rustc_serialize Fix the FileEncoder buffer size. 2023-05-15 08:59:11 +10:00
rustc_session Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_smir Encode types in SMIR 2023-05-08 14:23:19 +00:00
rustc_span Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_symbol_mangling Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
rustc_target Auto merge of #111933 - matthiaskrgr:rollup-m10k3ts, r=matthiaskrgr 2023-05-25 06:02:11 +00:00
rustc_trait_selection Match on both reveal and solver mode at the same time 2023-05-25 03:35:14 +00:00
rustc_traits Prepopulate opaques in canonical input 2023-05-25 03:21:22 +00:00
rustc_transmute Remove unused TypeFoldable/TypeVisitable impls. 2023-04-26 15:19:50 +10:00
rustc_ty_utils ensure !Unpin types do not get noalias 2023-05-20 19:34:31 -04:00
rustc_type_ir Implement references VarDebugInfo. 2023-05-13 10:12:14 +00:00