about summary refs log tree commit diff
path: root/compiler/rustc_monomorphize
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-09 09:45:36 +0000
committerbors <bors@rust-lang.org>2025-07-09 09:45:36 +0000
commit6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34 (patch)
tree88c9ab784427c2f2693224ea808f161185ce5b81 /compiler/rustc_monomorphize
parent558d25371fe1cc3d907ebcfc4e12d3c27acbe2b7 (diff)
parentbb643159786c789c0b64f819d36a0979c63f9791 (diff)
downloadrust-6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34.tar.gz
rust-6b3ae3f6e45a33c2d95fa0362c9b2593e567fd34.zip
Auto merge of #143472 - dianne:deref-pat-column-check, r=Nadrieril
`rustc_pattern_analysis`: always check that deref patterns don't match on the same place as normal constructors

In rust-lang/rust#140106, deref pattern validation was tied to the `deref_patterns` feature to temporarily avoid affecting perf. However:
- As of rust-lang/rust#143414, box patterns are represented as deref patterns in `rustc_pattern_analysis`. Since they can be used by enabling `box_patterns` instead of `deref_patterns`, it was possible for them to skip validation, resulting in an ICE. This fixes that and adds a regression test.
- External tooling (e.g. rust-analyzer) will also need to validate matches containing deref patterns, which was not possible. This fixes that by making `compute_match_usefulness` validate deref patterns by default.

In order to avoid doing an extra pass for anything with patterns, the second commit makes `RustcPatCtxt` keep track of whether it encounters a deref pattern, so that it only does the check if so. This is purely for performance. If the perf impact of the first commit is negligible and the complexity cost introduced by the second commit is significant, it may be worth dropping the latter.

r? `@Nadrieril`
Diffstat (limited to 'compiler/rustc_monomorphize')
0 files changed, 0 insertions, 0 deletions