about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src/lib.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-05 00:12:12 +0200
committerGitHub <noreply@github.com>2025-07-05 00:12:12 +0200
commite0dd7ecac11363cbdd6cb2fc9c33b983e9f7fe31 (patch)
tree50e63f65d2cb656207ed7568198370fde52ae675 /compiler/rustc_pattern_analysis/src/lib.rs
parent2cde070b335a241d143a47990f40db8c0a2d3d88 (diff)
parent98659a339dd7203e0f23871b327b9305940e0d61 (diff)
downloadrust-e0dd7ecac11363cbdd6cb2fc9c33b983e9f7fe31.tar.gz
rust-e0dd7ecac11363cbdd6cb2fc9c33b983e9f7fe31.zip
Rollup merge of #143414 - dianne:box-usefulness-cleanup, r=Nadrieril
remove special-casing of boxes from match exhaustiveness/usefulness analysis

As a first step in replacing `box_patterns` with `deref_patterns`, this treats box patterns as deref patterns in the THIR and exhaustiveness analysis. This allows a bunch of special-casing to be removed. The emitted MIR is unchanged.

Incidentally, this fixes a bug caused by box patterns being treated like structs rather than pointers, where enabling `exhaustive_patterns` (rust-lang/rust#51085) could give rise to spurious `unreachable_patterns` lints on arms required for exhaustiveness. Following the lint's advice to remove the match arm would result in an error. I'm not sure what the current state of `exhaustive_patterns` is with regard to reference/box opsem, or whether there's any intention to have `unreachable_patterns` be more granular than the whole arm, but regardless this should hopefully make them easier to handle consistently.

Tracking issue for deref patterns: rust-lang/rust#87121

r? `@Nadrieril`
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
0 files changed, 0 insertions, 0 deletions