about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-19 14:03:56 +0000
committerbors <bors@rust-lang.org>2024-02-19 14:03:56 +0000
commitfa2a3c5208529ddd882f75c9a2324483273242a4 (patch)
treeeebcab9104f153486075f780e73de41d98e5cff2 /compiler/rustc_codegen_llvm/src
parent74f611f7fc48c68924464667594dac8719a64a21 (diff)
parent087c7c828d5e5730fbf8cfe4cbc398e27c66a60e (diff)
downloadrust-fa2a3c5208529ddd882f75c9a2324483273242a4.tar.gz
rust-fa2a3c5208529ddd882f75c9a2324483273242a4.zip
Auto merge of #12059 - roife:fix/issue-11223, r=Alexendoo
Fix issue 11223: add check for identical guards in lint `match_same_arms`

fixes #11223

In the current `match_same_arms` implementation, if arms have guards, they are considered different. This commit adds equality checking for guards: arms are now considered equivalent only when they either both have no guards or their guards are identical.

The portion responsible for checking guard equality is refactored to reuse the existing code for checking body equality. This is abstracted into a function called `check_eq_with_pat`. To optimize performance, `check_same_guard` and `check_same_body` here use closures for lazy evaluation, ensuring that the calculation is only performed when `!(backwards_blocking_idxs...)` is true.

changelog: [`match_same_arms`]: Add check for identical guards
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions