Skip to content
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

Do not use "nil" to refer to () #70812

Merged
merged 1 commit into from
Apr 5, 2020

Conversation

rossmacarthur
Copy link
Contributor

@rossmacarthur rossmacarthur commented Apr 5, 2020

"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".

@rust-highfive
Copy link
Collaborator

r? @LukasKalbertodt

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 5, 2020
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a 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.

@rossmacarthur
Copy link
Contributor Author

rossmacarthur commented Apr 5, 2020

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 5, 2020

@rossmacarthur: 🔑 Insufficient privileges: Not in reviewers

@bors
Copy link
Contributor

bors commented Apr 5, 2020

@rossmacarthur: 🔑 Insufficient privileges: not in try users

@rossmacarthur
Copy link
Contributor Author

rossmacarthur commented Apr 5, 2020

@LukasKalbertodt I don't think I have sufficient privileges to tell bors to merge. CI is green now though.

@bors
Copy link
Contributor

bors commented Apr 5, 2020

@rossmacarthur: 🔑 Insufficient privileges: Not in reviewers

@bors
Copy link
Contributor

bors commented Apr 5, 2020

@rossmacarthur: 🔑 Insufficient privileges: not in try users

@Mark-Simulacrum
Copy link
Member

@bors r=LukasKalbertodt

@bors
Copy link
Contributor

bors commented Apr 5, 2020

📌 Commit bc26f58 has been approved by LukasKalbertodt

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 5, 2020
@jonas-schievink
Copy link
Contributor

@bors rollup

@LukasKalbertodt
Copy link
Member

@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!

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 5, 2020
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
@bors bors merged commit 4827aa6 into rust-lang:master Apr 5, 2020
@rossmacarthur rossmacarthur deleted the fix/unit-called-nil branch April 6, 2020 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants