-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conversation
r? @notriddle (rustbot has picked a reviewer for you, use r? to override) |
@@ -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()), |
There was a problem hiding this comment.
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)
...
@bors r+ rollup |
🌲 The tree is currently closed for pull requests below priority 50. This pull request will be tested once the tree is reopened. |
…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
We don't want to use
type_of(type_alias)
, we want to usetype_of(impl)
-- this will give us the self type of the impl properly substituted in the case that it's an alias.Fixes #111420