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
Edition 2024: Make !
fall back to !
#123508
base: master
Are you sure you want to change the base?
Conversation
Nominating for T-lang discussion. This PR changes never type fallback in the 2024 edition. I'm asking for approval, given that this is part of the following plan:
|
!
fallback to !
!
fall back to !
Might worth add #66173 and #66757 as tests. fn test66173() {
let x = match true {
true => Default::default(),
false => panic!("..."),
};
// print `x` type
}
fn test66757() {
struct E;
impl From<!> for E {
fn from(_: !) -> E {
E
}
}
#[allow(unreachable_code)]
fn foo(never: !) {
<E as From<!>>::from(never); // Ok
<E as From<_>>::from(never); // Should the inference fail?
}
} |
@rfcbot merge This PR changes fallback to
These lints are valuable in all editions because they both address "suspicious" / error-prone code. They also catch the cases that could change behavior. Ideally we'll have them before we get to the new edition, if not, we'll want to revisit whether to proceed. |
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), 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! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
@crlf0710 do those tests look good to you? |
I'm happy with doing this, contingent on having mitigations to avoid unsafe code changing behavior. @rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
This PR changes never type fallback to be
!
(the never type itself) in the next, 2024, edition.This makes the never type's behavior more intuitive (in 2024 edition) and is the first step of the path to stabilize it.
r? @compiler-errors