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

Patterns of empty types #115

Open
3 of 8 tasks
nikomatsakis opened this issue Jul 22, 2024 · 5 comments
Open
3 of 8 tasks

Patterns of empty types #115

nikomatsakis opened this issue Jul 22, 2024 · 5 comments

Comments

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Jul 22, 2024

Metadata
Owner(s) @Nadrieril
Team(s) compiler, lang
Goal document 2024h2/Patterns-of-empty-types

Summary

Introduce an RFC for never patterns or other solutions for patterns involving uninhabited types.

Tasks and status

  • Stabilize min_exhaustive_patterns (@Nadrieril)
  • Defer linting of newly-unreachable arms til later (@Nadrieril)
  • Write up "never patterns" RFC (@Nadrieril)
  • Submit RFC, discuss and wait for acceptance (lang Team)
  • Implement never patterns (@Nadrieril)
  • Amend exhaustive_patterns to only apply to the case of empty types behind references (@Nadrieril)
  • Decide on stabilization of exhaustive_patterns (lang Team)
  • Decide on linting of the newly-unreachable arms (lang Team)
@nikomatsakis nikomatsakis added this to the 2024h2 milestone Jul 22, 2024
@rust-lang rust-lang locked and limited conversation to collaborators Jul 25, 2024
@nikomatsakis
Copy link
Contributor Author

This issue is intended for status updates only.

For general questions or comments, please contact the owner(s) directly.

@Nadrieril
Copy link
Member

Nadrieril commented Jul 27, 2024

Here's the status we're at today, at the start of the goal period:

  • The exhaustive_patterns feature has been usable for years but was deemed not-stabilizable-as-is; I aim to deprecate it as part of this goal;
  • The min_exhaustive_patterns feature has been proposed, implemented, and approved for stabilization. Stabilization was blocked on improving lints; this is about to be resolved;
  • My proposal for never patterns got sufficient approval to enable experimentation. The unstable feature is now in a usable state, though not complete;
  • I have an RFC draft for never patterns lying around. It needs to be fleshed out and updated in light of min_exhaustive_patterns being stabilized, after which we can start the RFC process.

@Nadrieril
Copy link
Member

Update since last time:

  • The min_exhaustive_patterns feature has been stabilized, it will be accessible in 1.82.0;
  • The stabilization caused issues because we went from requiring some match arms to warning against them. There was some discussion on the topic, and it was decided to revert the linting behavior for now and find a solution that has a smoother transition.

Next steps:

  • Backport the approved linting change to beta;
  • Implement whatever linting mitigation we end up deciding on;
  • Finish writing up the never patterns RFC.

@Nadrieril
Copy link
Member

Update since last time:

  • We reverted the linting behavior until an unspecified date

Next steps:

  • Decide what we want to do with linting;
  • Write the never patterns RFC.

@Nadrieril
Copy link
Member

Update since last time:

  • The never patterns RFC was posted.
  • Feedback on the RFC suggests that the question of "which arms can be omitted" isn't as orthogonal as I hoped, so I'll switch focus to that.

Next steps:

  • Amend exhaustive_patterns to only apply to the case of empty types behind references;
  • Propose stabilization of exhaustive_patterns, i.e. allow omitting a match arm even when the empty type is behind a reference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants