-
-
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
base: main
Are you sure you want to change the base?
stabilize never type #155499
Changes from all commits
158e13d
7c696e5
a270f54
504c3f4
e75922e
89f4460
adf3321
a5480c5
33e54a8
a0ad7ef
848b1d7
4cdf1e4
cb9dd7a
8a9b1e0
37e5a8b
c68a504
a7aac81
4451fe4
08d1e2f
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.