Find a file
bors 7e552b46af 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
.github Handle PR not found in post-merge workflow 2025-05-06 18:35:05 +02:00
compiler Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril 2025-05-08 02:16:45 +00:00
library Rollup merge of #140734 - ivmarkov:master, r=joboet 2025-05-07 18:19:08 +02:00
LICENSES
src Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril 2025-05-08 02:16:45 +00:00
tests Auto merge of #140106 - dianne:deref-pat-usefulness, r=Nadrieril 2025-05-08 02:16:45 +00:00
.clang-format
.editorconfig
.git-blame-ignore-revs git: ignore 60600a6fa4 for blame purposes 2025-04-17 11:50:24 +08:00
.gitattributes
.gitignore
.gitmodules
.ignore
.mailmap
bootstrap.example.toml add rust.debug-assertions-tools option 2025-04-29 11:05:06 +02:00
Cargo.lock Rollup merge of #140709 - notriddle:rm-unportable-markdown, r=GuillaumeGomez 2025-05-07 00:29:25 +00:00
Cargo.toml Merge commit '0621446356' into clippy-subtree-update 2025-04-22 18:24:43 +02:00
CODE_OF_CONDUCT.md
configure
CONTRIBUTING.md
COPYRIGHT
INSTALL.md mention about x.py setup in INSTALL.md 2025-04-24 09:15:53 +03:00
LICENSE-APACHE
license-metadata.json
LICENSE-MIT
README.md
RELEASES.md
REUSE.toml
rust-bors.toml
rustfmt.toml Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
triagebot.toml Rollup merge of #140195 - jieyouxu:minicore-triagebot, r=jieyouxu 2025-04-24 11:40:44 +02:00
x
x.ps1
x.py

This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.

Why Rust?

  • Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.

  • Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.

  • Productivity: Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool (Cargo), auto-formatter (rustfmt), linter (Clippy) and editor support (rust-analyzer).

Quick Start

Read "Installation" from The Book.

Installing from Source

If you really want to install from source (though this is not recommended), see INSTALL.md.

Getting Help

See https://www.rust-lang.org/community for a list of chat platforms and forums.

Contributing

See CONTRIBUTING.md.

License

Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Trademark

The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the "Rust Trademarks").

If you want to use these names or brands, please read the Rust language trademark policy.

Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.