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

Stabilize (only) the never type #58184

Open
SimonSapin opened this Issue Feb 5, 2019 · 5 comments

Comments

Projects
None yet
5 participants
@SimonSapin
Copy link
Contributor

SimonSapin commented Feb 5, 2019

This is an alternative to #57012 that does not propose changing the type inference fallback (yet). This unblocks TryFrom and TryInto #33417.

#49593 has now been fixed. This was the reason for the previous revert of stabilization (#50121).

What is being stabilized

What is not being stabilized

  • Exhaustive pattern-matching for uninhabited types. eg.

    let x: Result<u32, !> = ...;
    let Ok(y) = x;

    This code will still complain that Ok(_) is a refutable pattern. This can be fixed by using the exhaustive_patterns feature gate. See RFC 1872 for progress on this issue. See https://github.com/rust-lang/rust/tree/master/src/test/ui/feature-gate-exhaustive-patterns.rs for the testcase which confirms that this behaviour is still gated.

  • The type inference changes proposed in #48950 are not part of this proposal, since they can break some previously-valid programs and the mitigations discussed in #57012 are not ready yet.

    This change is moved to a new dedicated feature gate, inference_fallback_to_never, instead of never_type.

@SimonSapin SimonSapin added the T-lang label Feb 5, 2019

@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Feb 5, 2019

@rfcbot fcp merge

There is currently a lack of consensus regarding the change to fallback and how to handle edge case breakages. I don't believe there is any reason this change has to be tied together with making ! usable from stable, for which we have a strong consensus and a lot of groundwork laid. I think its a reasonable way to move forward for us to separate these two changes, so we can stabilize ! now without blocking it (and by extension, TryFrom) on reaching consensus about the fallback changes.

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Feb 5, 2019

Team member @withoutboats has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@SimonSapin

This comment has been minimized.

Copy link
Contributor Author

SimonSapin commented Feb 5, 2019

It was pointed out to me that #![feature(never_type)] changes inference in current Nightly. I’ve edited the proposal to mention moving that to a new feature gate.

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Feb 5, 2019

@rfcbot concern motivation-to-change-fallback

I'm concerned that if we stabilize ! now without the fallback change then there won't be sufficient motivation for us to land the fallback change later, and we'll lose out on a feature that would have made the language better. IMO we should go ahead with the full stabilization-- there are inference changes that we don't currently warn against, but we've traditionally allowed such breakages in other places and I don't believe this change is more significant or detrimental.

@Centril

This comment has been minimized.

Copy link
Contributor

Centril commented Feb 5, 2019

@rfcbot concern eddybs-concern-on-the-other-issue

See #57012 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment