Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for release notes of #122792: Stabilize min_exhaustive_patterns #129579

Closed
1 of 4 tasks
rustbot opened this issue Aug 25, 2024 · 4 comments
Closed
1 of 4 tasks
Labels
I-release-nominated Nominated for the release team. relnotes Marks issues that should be documented in the release notes of the next release. relnotes-tracking-issue Marks issues tracking what text to put in release notes. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue.
Milestone

Comments

@rustbot
Copy link
Collaborator

rustbot commented Aug 25, 2024

This issue tracks the release notes text for #122792.

  • Issue is nominated for the responsible team (and T-release nomination is removed).
  • Proposed text is drafted by team responsible for underlying change.
  • Issue is nominated for release team review of clarity for wider audience.
  • Release team includes text in release notes/blog posts.

Release notes text:

The section title will be de-duplicated by the release team with other release notes issues.
Prefer to use the standard titles from previous releases.
More than one section can be included if needed.

# Language
- [Patterns matching empty types can now be omitted in common cases](https://github.com/rust-lang/rust/pull/122792)

Release blog section (if any, leave blank if no section is expected):

Empty patterns can now be omitted in common cases:

```rust
pub fn safe_unwrap<T>(x: Result<T, !>) -> T {
    let Ok(x) = x; // the `Err` case does not need to appear
    x
}

// TODO: other examples, maybe std's PoisonError?
```

This is particularly useful in combination with the never type `!`, but also works with other empty types such a variantless enum (`enum Void {}`).

For reasons related to uninitialized values and unsafe code, this behavior is not allowed if the empty type is accessed through a reference, pointer, or union field:
```rust
pub fn safe_unwrap_ref<T>(x: &Result<T, !>) -> &T {
    match x {
        Ok(x) => x,
        Err(never) => match *never {}, // this branch cannot be omitted because of the reference
    }
}
```

To avoid interfering with crates that wish to support several rust versions, these branches are not yet warned as "unreachable", despite the fact that they can be removed.
@rustbot rustbot added I-release-nominated Nominated for the release team. relnotes Marks issues that should be documented in the release notes of the next release. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 25, 2024
@Mark-Simulacrum Mark-Simulacrum added I-lang-nominated Nominated for discussion during a lang team meeting. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. I-release-nominated Nominated for the release team. labels Aug 25, 2024
@Mark-Simulacrum
Copy link
Member

This may or may not want to incorporate notes for #129031.

@saethlin saethlin added the T-release Relevant to the release subteam, which will review and decide on the PR/issue. label Aug 25, 2024
@Mark-Simulacrum Mark-Simulacrum added this to the 1.82.0 milestone Aug 27, 2024
@traviscross
Copy link
Contributor

@Nadrieril: What do you think?

cc @rust-lang/lang

@Mark-Simulacrum Mark-Simulacrum added the relnotes-tracking-issue Marks issues tracking what text to put in release notes. label Sep 6, 2024
@Nadrieril
Copy link
Member

Nadrieril commented Sep 7, 2024

Should I edit the OP? I'm not sure how this works.

@traviscross traviscross added T-lang Relevant to the language team, which will review and decide on the PR/issue. relnotes Marks issues that should be documented in the release notes of the next release. I-release-nominated Nominated for the release team. relnotes-tracking-issue Marks issues tracking what text to put in release notes. and removed relnotes Marks issues that should be documented in the release notes of the next release. I-lang-nominated Nominated for discussion during a lang team meeting. relnotes-tracking-issue Marks issues tracking what text to put in release notes. labels Sep 24, 2024
@Mark-Simulacrum
Copy link
Member

Yes. I've revised the release note section a bit to not reference the semi-internal name (min_exhaustive_patterns) which we try to stay away from in favor of something more user-facing.

@cuviper cuviper closed this as completed Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-release-nominated Nominated for the release team. relnotes Marks issues that should be documented in the release notes of the next release. relnotes-tracking-issue Marks issues tracking what text to put in release notes. T-lang Relevant to the language team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants