Skip to content

Cleanup: rename middle::ty::sty and its variants. #26232

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

Merged
merged 1 commit into from
Jun 12, 2015

Conversation

eefriedman
Copy link
Contributor

Use camel-case naming, and use names which actually make sense in modern Rust.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

☔ The latest upstream changes (presumably #26225) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb
Copy link
Member

eddyb commented Jun 12, 2015

LGTM, but a could of names seem somewhat long: TyReference and TyArrayOrSlice.
Another thought is that the Ty prefix could be dropped if Ty::Foo could be made to work instead (right now it's not looking so great).

@eefriedman
Copy link
Contributor Author

I can shorten TyReference to TyRef without much loss of clarity.

I don't really know how to shorten TyArrayOrSlice; TyVec like master uses is misleading, neither TySquare or TyAOrS is obvious, and I can't think of anything else. I'm thinking it will get split into TyArray and TySlice in a followup, so maybe just leave it for now?

As for getting rid of the Ty prefix, it might be possible to rename TypeVariants to something shorter like TyV, sprinkle some use rustc::middle::ty::TyV into other modules, and write TyV::Int instead of ty::TyInt. Not sure if that's worthwhile.

@nrc
Copy link
Member

nrc commented Jun 12, 2015

In general, I don't mind long names so much. TyRef is fine. I think TyArray would be fine instead of TyArrayOrSlice - it is close enough. Dropping the Ty prefix in favour of Ty:: would be nice. But I don't want to see TyV at all - that's indecipherable. (In general, we have a history of short and somewhat bad names in the compiler and we've been moving towards longer, more understandable names. Obviously there are specific places where concision is still warranted though).

ty_uint(ast::UintTy),
ty_float(ast::FloatTy),
/// Substs here, possibly against intuition, *may* contain `ty_param`s.
pub enum TypeVariants<'tcx> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe Types rather than TyV or TypeVariants?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @nikomatsakis also mentioned TyKind a long time ago (when I considered making this cleanup).

@nrc
Copy link
Member

nrc commented Jun 12, 2015

This is a great PR, I've wanted to rename these things for a while. Thanks for making the changes. If you could at least change TyArrayOrSlice and TyReference we could land this. You could try changing to use the prefix, or we could land this and do that as a follow up - I realise this PR will rot quite quickly.

@eefriedman eefriedman force-pushed the rename-sty branch 2 times, most recently from 877fef6 to 9fad9af Compare June 12, 2015 04:40
@eefriedman
Copy link
Contributor Author

Rebased, and amended to use TyRef and TyArray.

I think I'll experiment with the prefixes later; there's already a variant named "Types" in librustc/middle/infer/mod.rs.

@nrc
Copy link
Member

nrc commented Jun 12, 2015

@bors: r+ p=1

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

📌 Commit 9fad9af has been approved by nrc

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

⌛ Testing commit 9fad9af with merge 7626e9f...

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

💔 Test failed - auto-linux-64-nopt-t

@eefriedman
Copy link
Contributor Author

I didn't rebase correctly; sorry about the churn. Amended with fix.

@nrc
Copy link
Member

nrc commented Jun 12, 2015

@bors: r+ p=1

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

📌 Commit 00f86fe has been approved by nrc

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

⌛ Testing commit 00f86fe with merge f4bdebf...

bors added a commit that referenced this pull request Jun 12, 2015
Use camel-case naming, and use names which actually make sense in modern Rust.
@bors
Copy link
Collaborator

bors commented Jun 12, 2015

💔 Test failed - auto-mac-64-opt

Use camel-case naming, and use names which actually make sense in modern Rust.
@eefriedman
Copy link
Contributor Author

Updated again; I thought I had built everything, but I somehow missed librustdoc.

@eddyb
Copy link
Member

eddyb commented Jun 12, 2015

@bors r=nrc

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

📌 Commit 3c69db4 has been approved by nrc

@bors
Copy link
Collaborator

bors commented Jun 12, 2015

⌛ Testing commit 3c69db4 with merge 85b5338...

bors added a commit that referenced this pull request Jun 12, 2015
Use camel-case naming, and use names which actually make sense in modern Rust.
@bors bors merged commit 3c69db4 into rust-lang:master Jun 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants