-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Do not use "nil" to refer to ()
#70812
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
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'm in favor of this change. These docs were added 5 years ago, but that was likely just moving them from somewhere else. A quick google search also didn't bring up any recent mentions of nil
in context of Rust referring to the unit type. I only found results from 2011 and 2012.
What I'd like to get mentioned is void
from languages like Java, C++ etc. I think it would be useful for people coming from those languages to know that ()
is basically equivalent to void
(though it's a full type, unlike in some other languages). And yes I know that in languages like Haskell, void
means something different (namely, bottom = never type). Maybe we can mention the equivalents to ()
in several languages?
We can include those changes in a new PR though. I'd just merge this when CI is green.
@bors r+ rollup |
@rossmacarthur: 🔑 Insufficient privileges: Not in reviewers |
@rossmacarthur: 🔑 Insufficient privileges: not in try users |
@LukasKalbertodt I don't think I have sufficient privileges to tell bors to merge. CI is green now though. |
@rossmacarthur: 🔑 Insufficient privileges: Not in reviewers |
@rossmacarthur: 🔑 Insufficient privileges: not in try users |
@bors r=LukasKalbertodt |
📌 Commit bc26f58 has been approved by |
@bors rollup |
@rossmacarthur Sorry for being imprecise. What I wanted to say is: "once the CI is green, I will merge". But then I went on a bike tour and @Mark-Simulacrum was faster. Thanks! |
Rollup of 5 pull requests Successful merges: - rust-lang#67797 (Query-ify Instance::resolve) - rust-lang#70777 (Don't import integer and float modules, use assoc consts) - rust-lang#70795 (Keep track of position when deleting from a BTreeMap) - rust-lang#70812 (Do not use "nil" to refer to `()`) - rust-lang#70815 (Enable layout debugging for `impl Trait` type aliases) Failed merges: r? @ghost
"nil" is not used in the book or in the standard library docs anywhere else. Because "nil" is often used in programming languages to refer to "None" or "null" I think it could be a little confusing for newcomers to see this type referred to as "nil".