-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add docs for "!" Never type (rfc 1216) #35286
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@@ -162,6 +162,7 @@ | |||
<!-- Various things involving parens and tuples --> | |||
|
|||
* `()`: empty tuple (*a.k.a.* unit), both literal and type. | |||
* `!`: empty type (*a.k.a.* unit), both literal and type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be something other than "unit".
rust-lang/rfcs#1216 doesn't contain |
85b0966
to
0ff8841
Compare
Good point. Changed it |
Seems OK. Do we want to wait for the |
Also, we might want to change the grammar for fn items, which probably specifies |
Currently it has a special entry with a link: Since it is a very special case, what would you change? |
I think there's some confusion here. |
I would remove the |
Also |
0ff8841
to
43b98f7
Compare
I would leave the |
### Never expressions | ||
|
||
```antlr | ||
never_expr : "!" ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still isn't right. !
isn't an expression, just a type (although the sections for primitive types is nothing but FIXMEs at the moment).
☔ The latest upstream changes (presumably #35769) made this pull request unmergeable. Please resolve the merge conflicts. |
I agree with @canndrew's edits, though if the type is called never -- isn't it? I forget -- let's just call it that. |
0929661
to
2632691
Compare
I added the word "always" and capitalized the never to prevent the missreading @apasel422 mentioned, but I am not sure if it enhances the readability over all. I agree with @nikomatsakis, it is no longer a special case but I kept the reference to the Diverging Functions |
2632691
to
d9bd4d5
Compare
@@ -764,6 +764,13 @@ bound-list := bound | bound '+' bound-list | |||
bound := path | lifetime | |||
``` | |||
|
|||
### Never type | |||
An empty type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better, though I feel like we could say a lot more here. :) For example, "A type representing the result of a function which never returns -- for example because it panics or goes into an infinite loop."
Well, this has been inactive for a while. I'm going to just merge it since it seems like an improvement, even if I think we could expand the text. |
@bors r+ rollup |
📌 Commit d9bd4d5 has been approved by |
…komatsakis Add docs for "!" Never type (rfc 1216) Pull Request: rust-lang/rfcs#1216 Tracking Issue: rust-lang#35121
Pull Request: rust-lang/rfcs#1216
Tracking Issue: #35121