-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustdoc: Fix handling of Self
type in search index and refactor its representation
#128471
Changes from all commits
249d686
664b3ff
4e348fa
e452e3d
b4f77df
dac7f20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,7 +468,7 @@ pub(crate) fn resolve_type(cx: &mut DocContext<'_>, path: Path) -> Type { | |
match path.res { | ||
Res::PrimTy(p) => Primitive(PrimitiveType::from(p)), | ||
Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } if path.segments.len() == 1 => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe that the handling of
impl MyCustomType<i32> { /* Self is a SelfTypeAlias here */ } There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thanks for raising this. I believe that some other part of rustdoc is "unwrapping" the Regarding your comment about the change in representation: I understand that I do intend to add information about the meaning of the type (alias, with value, or parameter, with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
No, that's not the reason. You've linked to This is due to the fact that in the local case rustdoc cleans the HIR which contains the still-unresolved This bug (or discrepancy at least) is tracked in #44306. See my latest comment from almost a year ago: #44306 (comment) describing how we might go about fixing it and why I haven't taken it on (yet). Note that that comment assumes we want to render |
||
Generic(kw::SelfUpper) | ||
Type::SelfTy | ||
} | ||
Res::Def(DefKind::TyParam, _) if path.segments.len() == 1 => Generic(path.segments[0].name), | ||
_ => { | ||
|
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.
Just an application of De Morgan rules combined with knowing that
clean::Generic(kw::SelfUpper)
is gone now.