-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
stabilize never type #155499
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 never type #155499
Changes from all commits
6656056
6ed4ce5
977c3a7
f34322b
046ebb7
3de37a2
00745cc
2b466a3
ab2a410
9b02a7e
11eebd5
e9d08de
39c6cac
cfc82eb
3419a3c
748439c
b74b72b
0a35c2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -493,24 +493,14 @@ impl<'tcx> LoweredTy<'tcx> { | |
| } | ||
|
|
||
| fn never_type_behavior(tcx: TyCtxt<'_>) -> (DivergingFallbackBehavior, DivergingBlockBehavior) { | ||
| // FIXME(waffle): rip out the whole system which allows you to choose never type fallback | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to do this immediately after this PR lands, so that this is not forgotten. Rust analyzer seems to have its own copy of this enum, funnily enough.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| let (fallback, block) = parse_never_type_options_attr(tcx); | ||
| let fallback = fallback.unwrap_or_else(|| default_fallback(tcx)); | ||
| let fallback = fallback.unwrap_or_else(|| DivergingFallbackBehavior::ToNever); | ||
| let block = block.unwrap_or_default(); | ||
|
|
||
| (fallback, block) | ||
| } | ||
|
|
||
| /// Returns the default fallback which is used when there is no explicit override via `#![never_type_options(...)]`. | ||
| fn default_fallback(tcx: TyCtxt<'_>) -> DivergingFallbackBehavior { | ||
| // Edition 2024: fallback to `!` | ||
| if tcx.sess.edition().at_least_rust_2024() { | ||
| return DivergingFallbackBehavior::ToNever; | ||
| } | ||
|
|
||
| // Otherwise: fallback to `()` | ||
| DivergingFallbackBehavior::ToUnit | ||
| } | ||
|
|
||
| fn parse_never_type_options_attr( | ||
| tcx: TyCtxt<'_>, | ||
| ) -> (Option<DivergingFallbackBehavior>, Option<DivergingBlockBehavior>) { | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.