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

Use proper impl self type for alias impl in rustdoc #111448

Merged
merged 1 commit into from
May 11, 2023

Conversation

compiler-errors
Copy link
Member

We don't want to use type_of(type_alias), we want to use type_of(impl) -- this will give us the self type of the impl properly substituted in the case that it's an alias.

Fixes #111420

@rustbot
Copy link
Collaborator

rustbot commented May 10, 2023

r? @notriddle

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 10, 2023
@@ -2414,14 +2414,15 @@ fn clean_impl<'tcx>(
}

let for_ = clean_ty(impl_.self_ty, cx);
let type_alias = for_.def_id(&cx.cache).and_then(|did| match tcx.def_kind(did) {
DefKind::TyAlias => Some(clean_middle_ty(
ty::Binder::dummy(tcx.type_of(did).subst_identity()),
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess alternatively we could keep using type_of(alias_def_id) here if we were passing it the right substs, but I don't think rustdoc needs to go through the whole effort of computing the correct substitutions for a type alias here, considering generic defaults and stuff like that.

Astconv does that for us by just calling type_of(impl_def_id)...

@notriddle
Copy link
Contributor

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 11, 2023

📌 Commit 6509c42 has been approved by notriddle

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented May 11, 2023

🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened.

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

Rollup of 7 pull requests

Successful merges:

 - rust-lang#108705 (Prevent ICE with broken borrow in closure)
 - rust-lang#111292 (Fix mishandled `--check-cfg` arguments order)
 - rust-lang#111382 (Isolate coverage FFI type layouts from their underlying LLVM C++ types)
 - rust-lang#111385 (vec-shrink-panik: update expectations to work on LLVM 17)
 - rust-lang#111389 (Add esp-idf platform-support page)
 - rust-lang#111432 (Use visit_assign to detect SSA locals.)
 - rust-lang#111448 (Use proper impl self type for alias impl in rustdoc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 07af55e into rust-lang:master May 11, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 11, 2023
@compiler-errors compiler-errors deleted the rustdoc-alias-impl branch August 11, 2023 20:19
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-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.

Incorrect signature in documentation for implementation of generic alias
4 participants