deref patterns: impl DerefPure for more std types#123480
Merged
bors merged 1 commit intorust-lang:masterfrom May 3, 2024
Merged
deref patterns: impl DerefPure for more std types#123480bors merged 1 commit intorust-lang:masterfrom
DerefPure for more std types#123480bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
6 tasks
Member
Author
compiler-errors
approved these changes
May 3, 2024
Contributor
|
@bors r+ |
Collaborator
Contributor
|
@bors rollup oops |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 3, 2024
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#123480 (deref patterns: impl `DerefPure` for more std types) - rust-lang#124412 (io safety: update Unix explanation to use `Arc`) - rust-lang#124441 (String.truncate comment microfix (greater or equal)) - rust-lang#124594 (run-make-support: preserve tooks.mk behavior for EXTRACXXFLAGS) - rust-lang#124604 (library/std: Remove unused `gimli-symbolize` feature) - rust-lang#124607 (`rustc_expand` cleanups) - rust-lang#124609 (variable-precision float operations can differ depending on optimization levels) - rust-lang#124610 (Tweak `consts_may_unify`) - rust-lang#124626 (const_eval_select: add tracking issue) - rust-lang#124637 (AST pretty: Use `builtin_syntax` for type ascription) Failed merges: - rust-lang#124638 (Move some tests from `rustc_expand` to `rustc_parse`.) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 3, 2024
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 } ```
Member
|
@bors r- |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: deref patterns. The requirements of
DerefPurearen't precise yet, but these types unambiguously satisfy them.Interestingly, a hypothetical
impl DerefMut for Cowthat does aClonewould not be eligible forDerefPureif we allow mixing deref patterns with normal patterns. If the following is exhaustive then theDerefMutwould cause UB: