Skip to content

Rename HIR TypeBinding to AssocItemConstraint and related cleanup #125635

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

Closed

Conversation

fmease
Copy link
Member

@fmease fmease commented May 27, 2024

Rename hir::TypeBinding and ast::AssocConstraint to AssocItemConstraint and update all items and locals using the old terminology.

Motivation: The terminology type binding is extremely outdated. "Type bindings" not only include constraints on associated types but also on associated constants (feature associated_const_equality) and on RPITITs of associated functions (feature return_type_notation). Hence the word item in the new name. Furthermore, the word binding commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., AssocTy = Ty) were the only kind of associated item constraint. Nowadays however, we also have associated type bounds (e.g., AssocTy: Bound) for which the term binding doesn't make sense.


Old terminology (HIR, rustdoc):

`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)

Old terminology (AST, abbrev.):

`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`

New terminology (AST, HIR, rustdoc):

`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)

r? compiler-errors

@fmease fmease added C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 27, 2024
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 27, 2024
@fmease fmease removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 27, 2024
@rust-log-analyzer

This comment has been minimized.

@fmease fmease force-pushed the mv-type-binding-assoc-item-constraint branch from d5fdc9c to 06b28ed Compare May 28, 2024 01:11
@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@fmease fmease removed the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@rust-log-analyzer

This comment has been minimized.

@fmease fmease force-pushed the mv-type-binding-assoc-item-constraint branch from 06b28ed to 68bc049 Compare May 28, 2024 07:14
@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@fmease fmease removed the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@rust-log-analyzer

This comment has been minimized.

@fmease fmease force-pushed the mv-type-binding-assoc-item-constraint branch from 68bc049 to 6807342 Compare May 28, 2024 07:43
@rustbot rustbot added the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@fmease fmease removed the A-rustdoc-json Area: Rustdoc JSON backend label May 28, 2024
@fmease fmease changed the title [WIP] Rename HIR TypeBinding to AssocItemConstraint and related cleanup Rename HIR TypeBinding to AssocItemConstraint and related cleanup May 28, 2024
@fmease fmease marked this pull request as ready for review May 28, 2024 07:49
@rustbot
Copy link
Collaborator

rustbot commented May 28, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@fmease fmease added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 28, 2024
@rust-log-analyzer

This comment has been minimized.

@fmease fmease force-pushed the mv-type-binding-assoc-item-constraint branch from 6807342 to bcdda03 Compare May 28, 2024 08:02
@fmease fmease added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 30, 2024
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented May 30, 2024

📌 Commit 34c56c4 has been approved by compiler-errors

It is now in the queue for this repository.

@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 May 30, 2024
fmease added a commit to fmease/rust that referenced this pull request May 30, 2024
…constraint, r=compiler-errors

Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
@fmease
Copy link
Member Author

fmease commented May 30, 2024

CI takes too long, canceled.
@bors r-

@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 May 30, 2024
@bors
Copy link
Collaborator

bors commented May 31, 2024

📌 Commit 34c56c4 has been approved by compiler-errors

It is now in the queue for this repository.

@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 May 31, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 31, 2024
…constraint, r=compiler-errors

Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
bors added a commit to rust-lang-ci/rust that referenced this pull request May 31, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#125635 (Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup)
 - rust-lang#125774 (Avoid unwrap diag.code directly in note_and_explain_type_err)
 - rust-lang#125786 (Fold item bounds before proving them in `check_type_bounds` in new solver)
 - rust-lang#125790 (Don't recompute `tail` in `lower_stmts`)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 31, 2024
Rollup merge of rust-lang#125635 - fmease:mv-type-binding-assoc-item-constraint, r=compiler-errors

Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
@bors
Copy link
Collaborator

bors commented May 31, 2024

☔ The latest upstream changes (presumably #125797) 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 May 31, 2024
@fmease
Copy link
Member Author

fmease commented May 31, 2024

lol, how come an old version of this PR got merged??? I bors-reapproved the changes after the latest force-push. I h*te old bors

@fmease
Copy link
Member Author

fmease commented May 31, 2024

I guess it'd be the best to just close this PR then instead of rebasing onto the lastest master as it would render the diff a two-line fmt change to the clippy subtree. That wouldn't helpful be at all for posterity

@fmease fmease closed this May 31, 2024
@fmease fmease deleted the mv-type-binding-assoc-item-constraint branch May 31, 2024 12:48
@fmease
Copy link
Member Author

fmease commented May 31, 2024

Dear posterity, this PR has effectively been merged

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 13, 2024
…constraint, r=compiler-errors

Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-rustdoc-json Area: Rustdoc JSON backend C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants