Skip to content

use Self alias in self types rather than manually substituting it #141289

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
May 21, 2025

Conversation

compiler-errors
Copy link
Member

Of the rougly 145 uses of self: Ty in the standard library, 5 of them don't use Self but instead choose to manually "substitute" the impl's self type into the type.

This leads to weird behavior sometimes (#140611 (comment)) -- to be clear, none of these usages actually trigger any bugs, but it's possible that they may break in the future (or at least lead to lints), so let's just "fix" them proactively.

@rustbot
Copy link
Collaborator

rustbot commented May 20, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 20, 2025
@jhpratt
Copy link
Member

jhpratt commented May 20, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 20, 2025

📌 Commit 7b5ea0e has been approved by jhpratt

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 20, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request May 20, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#140972 (Add TRACING_ENABLED to Machine and add enter_trace_span!())
 - rust-lang#141282 (`core_float_math`: Move functions to `math` module)
 - rust-lang#141288 (Get rid of unnecessary `BufDisplay` abstraction)
 - rust-lang#141289 (use `Self` alias in self types rather than manually substituting it)
 - rust-lang#141291 (link tracking issue in explicit-extern-abis.md)
 - rust-lang#141294 (triagebot: ping me if rustdoc js is modified)
 - rust-lang#141303 (Fix pagetoc inactive color in rustc book)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c052d26 into rust-lang:master May 21, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 21, 2025
Rollup merge of rust-lang#141289 - compiler-errors:more-self, r=jhpratt

use `Self` alias in self types rather than manually substituting it

Of the rougly 145 uses of `self: Ty` in the standard library, 5 of them don't use `Self` but instead choose to manually "substitute" the `impl`'s self type into the type.

This leads to weird behavior sometimes (rust-lang#140611 (comment)) -- **to be clear**, none of these usages actually trigger any bugs, but it's possible that they may break in the future (or at least lead to lints), so let's just "fix" them proactively.
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants