7

Use proper impl self type for alias impl in rustdoc by compiler-errors · Pull Re...

 1 year ago
source link: https://github.com/rust-lang/rust/pull/111448
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

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

drewcassidy reacted with hooray emoji

Collaborator

r? @notriddle

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

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()),

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)...

Contributor

@bors r+ rollup

Contributor

pushpin Commit 6509c42 has been approved by notriddle

It is now in the queue for this repository.

Contributor

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

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

merged commit 07af55e into

rust-lang:master

May 11, 2023

11 checks passed

rust-timer

added a commit to rust-lang-ci/rust that referenced this pull request

May 11, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

Milestone

1.71.0

Development

Successfully merging this pull request may close these issues.

Incorrect signature in documentation for implementation of generic alias

4 participants

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK