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

Rename ItemKind::Ty to ItemKind::TyAlias #63213

Merged
merged 3 commits into from
Aug 4, 2019

Conversation

varkor
Copy link
Member

@varkor varkor commented Aug 2, 2019

The current name is not entirely clear without context and TyAlias is consistent with ItemKind::TraitAlias.

Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

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

I think we should rename ImplItemKind::Type to ::Ty(pe)Alias also in that case.

src/librustc/hir/check_attr.rs Outdated Show resolved Hide resolved
src/librustc/hir/intravisit.rs Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Aug 2, 2019

Strongly agree with this change; ::Ty was pretty cryptic!

r=me when-green

@Centril
Copy link
Contributor

Centril commented Aug 2, 2019

r? @Centril

@rust-highfive rust-highfive assigned Centril and unassigned eddyb Aug 2, 2019
@varkor
Copy link
Member Author

varkor commented Aug 2, 2019

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 2, 2019

📌 Commit da36977b4fda3ef3b89004d9f375e72b33e2b09c has been approved by Centril

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 2, 2019
@bors
Copy link
Contributor

bors commented Aug 3, 2019

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

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 3, 2019
@bors
Copy link
Contributor

bors commented Aug 4, 2019

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout itemkind-tyalias (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self itemkind-tyalias --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging src/libsyntax_ext/deriving/generic/mod.rs
Auto-merging src/libsyntax/visit.rs
Auto-merging src/libsyntax/print/pprust.rs
Auto-merging src/libsyntax/parse/parser.rs
CONFLICT (content): Merge conflict in src/libsyntax/parse/parser.rs
Auto-merging src/libsyntax/mut_visit.rs
CONFLICT (content): Merge conflict in src/libsyntax/mut_visit.rs
Auto-merging src/libsyntax/feature_gate.rs
Auto-merging src/libsyntax/ext/build.rs
Auto-merging src/libsyntax/ast.rs
CONFLICT (content): Merge conflict in src/libsyntax/ast.rs
Auto-merging src/librustdoc/visit_ast.rs
Auto-merging src/librustdoc/clean/mod.rs
Auto-merging src/librustc_typeck/namespace.rs
CONFLICT (content): Merge conflict in src/librustc_typeck/namespace.rs
Auto-merging src/librustc_typeck/collect.rs
CONFLICT (content): Merge conflict in src/librustc_typeck/collect.rs
Auto-merging src/librustc_typeck/check/mod.rs
CONFLICT (content): Merge conflict in src/librustc_typeck/check/mod.rs
Auto-merging src/librustc_save_analysis/sig.rs
CONFLICT (content): Merge conflict in src/librustc_save_analysis/sig.rs
Auto-merging src/librustc_save_analysis/dump_visitor.rs
Auto-merging src/librustc_resolve/lib.rs
CONFLICT (content): Merge conflict in src/librustc_resolve/lib.rs
Auto-merging src/librustc_resolve/build_reduced_graph.rs
Auto-merging src/librustc_privacy/lib.rs
CONFLICT (content): Merge conflict in src/librustc_privacy/lib.rs
Auto-merging src/librustc_mir/monomorphize/collector.rs
Auto-merging src/librustc_metadata/encoder.rs
CONFLICT (content): Merge conflict in src/librustc_metadata/encoder.rs
Auto-merging src/librustc_lint/builtin.rs
CONFLICT (content): Merge conflict in src/librustc_lint/builtin.rs
Auto-merging src/librustc_incremental/persist/dirty_clean.rs
CONFLICT (content): Merge conflict in src/librustc_incremental/persist/dirty_clean.rs
Auto-merging src/librustc/middle/resolve_lifetime.rs
CONFLICT (content): Merge conflict in src/librustc/middle/resolve_lifetime.rs
Auto-merging src/librustc/middle/reachable.rs
CONFLICT (content): Merge conflict in src/librustc/middle/reachable.rs
Auto-merging src/librustc/middle/dead.rs
CONFLICT (content): Merge conflict in src/librustc/middle/dead.rs
Auto-merging src/librustc/infer/error_reporting/mod.rs
CONFLICT (content): Merge conflict in src/librustc/infer/error_reporting/mod.rs
Auto-merging src/librustc/hir/print.rs
CONFLICT (content): Merge conflict in src/librustc/hir/print.rs
Auto-merging src/librustc/hir/mod.rs
CONFLICT (content): Merge conflict in src/librustc/hir/mod.rs
Auto-merging src/librustc/hir/map/mod.rs
CONFLICT (content): Merge conflict in src/librustc/hir/map/mod.rs
Auto-merging src/librustc/hir/map/def_collector.rs
CONFLICT (content): Merge conflict in src/librustc/hir/map/def_collector.rs
Auto-merging src/librustc/hir/lowering.rs
CONFLICT (content): Merge conflict in src/librustc/hir/lowering.rs
Auto-merging src/librustc/hir/intravisit.rs
Auto-merging src/librustc/hir/check_attr.rs
CONFLICT (content): Merge conflict in src/librustc/hir/check_attr.rs
Automatic merge failed; fix conflicts and then commit the result.

@varkor
Copy link
Member Author

varkor commented Aug 4, 2019

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 4, 2019

📌 Commit fd819d0 has been approved by Centril

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 4, 2019
@bors
Copy link
Contributor

bors commented Aug 4, 2019

⌛ Testing commit fd819d0 with merge d3f8a0b...

bors added a commit that referenced this pull request Aug 4, 2019
Rename `ItemKind::Ty` to `ItemKind::TyAlias`

The current name is not entirely clear without context and `TyAlias` is consistent with `ItemKind::TraitAlias`.
@bors
Copy link
Contributor

bors commented Aug 4, 2019

☀️ Test successful - checks-azure
Approved by: Centril
Pushing d3f8a0b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 4, 2019
@bors bors merged commit fd819d0 into rust-lang:master Aug 4, 2019
phansch added a commit to phansch/rust-clippy that referenced this pull request Aug 5, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Aug 5, 2019
@eddyb
Copy link
Member

eddyb commented Aug 9, 2019

I think we should rename ImplItemKind::Type to ::Ty(pe)Alias also in that case.

No, that's an associated type...

@@ -1837,7 +1837,7 @@ pub enum ImplItemKind {
/// A method implementation with the given signature and body.
Method(MethodSig, BodyId),
/// An associated type.
Type(P<Ty>),
TyAlias(P<Ty>),
Copy link
Member

Choose a reason for hiding this comment

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

Basically I think this should be reverted. Also, as per some issue, Method should be Fn.

@Centril
Copy link
Contributor

Centril commented Aug 9, 2019

@eddyb
Copy link
Member

eddyb commented Aug 9, 2019

@Centril I've never heard "associated type alias" in the context of Rust, and also this PR only changes the impl-associated item, but not the trait-associated one.

@Centril
Copy link
Contributor

Centril commented Aug 9, 2019

Ah woops; we should change the trait one as well then since consistency is key.

As for "in the context of Rust", that's probably because it is just shorter to use the abbreviation. Folks in the Haskell / C++ communities usually don't say the full thing either.

Another suggestion for you if you don't like ::TyAlias: Let's consistently use ::Type for ItemKind, ImplItemKind, TraitItemKind.

@eddyb
Copy link
Member

eddyb commented Aug 9, 2019

I like Type because it matches the surface syntax (same with Const/Static/Fn).

@Centril
Copy link
Contributor

Centril commented Aug 9, 2019

Let's also rename OpaqueTy to OpaqueType in that case.

@eddyb I'll happily review that PR :)

@varkor
Copy link
Member Author

varkor commented Aug 11, 2019

I prefer TyAlias (or similar) over Ty (though AssocTy is also fine), because Ty is so overloaded and to someone unfamiliar with a particular enum, it can be unclear from usages whether it refers to the syntactic notion of type alias / associated type or an actual (type system) type. I tend to think about associated types as associated type aliases too.

this PR only changes the impl-associated item, but not the trait-associated one.

That was an oversight 👍 The intention was that they were all made consistent.

@varkor varkor deleted the itemkind-tyalias branch August 11, 2019 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

4 participants