Use proper impl self type for alias impl in rustdoc by compiler-errors · Pull Re...
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.
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
Collaborator
r? @notriddle (rustbot has picked a reviewer for you, use r? to override) |
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
@@ -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
The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No reviews
None yet
Successfully merging this pull request may close these issues.
Incorrect signature in documentation for implementation of generic alias
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK