forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#123480 - Nadrieril:impl-all-derefpures, r=compiler-errors deref patterns: impl `DerefPure` for more std types Context: [deref patterns](rust-lang#87121). The requirements of `DerefPure` aren't precise yet, but these types unambiguously satisfy them. Interestingly, a hypothetical `impl DerefMut for Cow` that does a `Clone` would *not* be eligible for `DerefPure` if we allow mixing deref patterns with normal patterns. If the following is exhaustive then the `DerefMut` would cause UB: ```rust match &mut Cow::Borrowed(&()) { Cow::Owned(_) => ..., // Doesn't match deref!(_x) if false => ..., // Causes the variant to switch to `Owned` Cow::Borrowed(_) => ..., // Doesn't match // We reach unreachable } ```
- Loading branch information
Showing
4 changed files
with
19 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters