rust-analyzer/crates
bors 4c2b4ca4f2 Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril
allow deref patterns to participate in exhaustiveness analysis

Per [this proposal](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Exhaustiveness), this PR allows deref patterns to participate in exhaustiveness analysis. Currently all deref patterns enforce `DerefPure` bounds on their scrutinees, so this assumes all patterns it's analyzing are well-behaved. This also doesn't support [mixed exhaustiveness](https://hackmd.io/4qDDMcvyQ-GDB089IPcHGg#Mixed-exhaustiveness), and instead emits an error if deref patterns are used together with normal constructors. I think mixed exhaustiveness would be nice to have (especially if we eventually want to support arbitrary `Deref` impls[^1]), but it'd require more work to get reasonable diagnostics[^2].

Tracking issue for deref patterns: #87121

r? `@Nadrieril`

[^1]: Regardless of whether we support limited exhaustiveness checking for untrusted `Deref` or always require other arms to be exhaustive, I think it'd be useful to allow mixed matching for user-defined smart pointers. And it'd be strange if it worked there but not for `Cow`.

[^2]: I think listing out witnesses of non-exhaustiveness can be confusing when they're not necessarily disjoint, and when you only need to cover some of them, so we'd probably want special formatting and/or explanatory subdiagnostics. And if it's implemented similarly to unions, we'd probably also want some way of merging witnesses; the way witnesses for unions can appear duplicated is pretty unfortunate. I'm not sure yet how the diagnostics should look, especially for deeply nested patterns.
2025-05-08 02:16:45 +00:00
..
base-db chore: Adjust panic context printing 2025-04-30 07:40:11 +02:00
cfg shrink_to_fit() in more places 2025-04-25 10:55:12 +03:00
edition chore: Bump Edition::CURRENT to 2024 2025-03-17 12:29:19 +01:00
hir remove a couple of clones 2025-05-01 11:41:42 +02:00
hir-def Remove duplicate impl of string unescape 2025-05-06 10:00:22 +00:00
hir-expand remove a couple of clones 2025-05-01 11:41:42 +02:00
hir-ty add stubbed-out cases for rust-analyzer 2025-05-06 18:53:55 -07:00
ide Render more lifetimes 2025-05-02 14:36:18 +02:00
ide-assists Render more lifetimes 2025-05-02 14:36:18 +02:00
ide-completion Improve let snippet 2025-05-03 17:04:11 +08:00
ide-db remove a couple of clones 2025-05-01 11:41:42 +02:00
ide-diagnostics Render more lifetimes 2025-05-02 14:36:18 +02:00
ide-ssr Make HirFileId, EditionedFileId and macro files Salsa struct 2025-04-19 22:10:52 +03:00
intern remove a couple of clones 2025-05-01 11:41:42 +02:00
load-cargo remove a couple of clones 2025-05-01 11:41:42 +02:00
mbe Remove unnecessary predefined symbol clones 2025-04-21 03:10:13 +03:00
parser Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, r=jieyouxu,wesleywiser 2025-05-06 16:28:39 +10:00
paths cargo fmt 2025-03-15 21:32:01 +01:00
proc-macro-api Adjust for salsa::Id::from_u32() being unsafe 2025-04-22 15:19:35 +03:00
proc-macro-srv Merge pull request #19704 from Veykril/push-wrvznvvpvtvp 2025-04-28 09:45:04 +00:00
proc-macro-srv-cli chore: Remove salsa dependency from proc-macro server again 2025-03-27 07:27:57 +01:00
profile Fix signature of libc memory usage function on Linux 2025-04-16 16:56:45 +03:00
project-model remove a couple of clones 2025-05-01 11:41:42 +02:00
query-group-macro remove a couple of clones 2025-05-01 11:41:42 +02:00
rust-analyzer Render more lifetimes 2025-05-02 14:36:18 +02:00
span Update salsa 2025-04-29 19:26:19 +02:00
stdx Cleanup cfg check handling in expression store lowering 2025-04-29 11:44:11 +02:00
syntax Rollup merge of #140035 - fee1-dead-contrib:push-oszwkkvmpkks, r=jieyouxu,wesleywiser 2025-05-06 16:28:39 +10:00
syntax-bridge Preallocate parser::Input 2025-04-25 17:18:14 +03:00
test-fixture remove a couple of clones 2025-05-01 11:41:42 +02:00
test-utils Merge pull request #19657 from ChayimFriedman2/better-offset-of 2025-04-22 13:28:34 +00:00
toolchain allow using null to unset an environment variable 2025-04-19 12:15:22 -04:00
tt Add expression fill mode variant for filling with underscore expressions 2025-04-28 10:39:36 +02:00
vfs cargo fmt 2025-03-15 21:32:01 +01:00
vfs-notify Cleanup cfg check handling in expression store lowering 2025-04-29 11:44:11 +02:00