-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: Cleanup various clean
types
#88379
Conversation
This comment has been minimized.
This comment has been minimized.
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.
Got about halfway through and ran out of time - this is amazing work ❤️ not sure why it's marked as a draft, but feel free to ignore the comments until you're happy with it :)
src/librustdoc/clean/mod.rs
Outdated
res: self.res, | ||
segments: if self.is_global() { &self.segments[1..] } else { &self.segments }.clean(cx), | ||
segments: self.segments.clean(cx), |
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.
Hmm, what will segments[0] be for a global path? Just an empty string?
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 thought kw::PathRoot
, but it may not be because otherwise I'd expect tests to be failing. I'll have to look into it.
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.
It will be kw::PathRoot
, which renders as {{root}}
, but I haven't found a way to make rustdoc (erroneously) print out {{root}}::foo::bar
. (It may be possible though.)
src/librustdoc/html/format.rs
Outdated
// Paths like `T::Output` and `Self::Output` should be rendered with all segments. | ||
resolved_path(f, did, path, is_generic, use_absolute, cx) | ||
resolved_path(f, did, path, path.is_generic(), use_absolute, cx) |
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.
You don't need to pass in path.is_generic, you can calculate it in resolved_path.
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.
You're looking at an old diff; I changed path.is_generic()
to false
in a later commit (the one we're nervous about ;).
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 should probably remove the comment above this call too.
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 have since dropped the commit that removed is_generic()
, so this place now has resolved_path(..., path.is_assoc_ty())
. I think resolved_path
and related functions need to be cleaned up a lot in general, but I think let's do that in a different PR so this one doesn't keep growing ;)
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.
Actually, it looks like I should be able to pretty easily clean up resolved_path
such that the argument that path.is_generic()
is used for is removed!
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.
... or not; it looks like there's a single place where use_absolute
is not false
and not None
:/
Thank you! ❤️ It's mainly marked as draft because some of the changes need more investigation (e.g., #88379 (comment)). |
Rebased to fix merge conflicts. |
This comment has been minimized.
This comment has been minimized.
Ok. Can you split those into a separate PR so we can land the rest? There are a lot of great changes here :) but it's an awfully large diff and it makes it harder to review the more subtle changes. |
Sure! That's another reason why I marked it as draft, since I expected it would need to be split up. |
96add5b
to
6ecaa70
Compare
@bors rollup=never Since this may improve performance. |
This comment has been minimized.
This comment has been minimized.
c901187
to
1fca27b
Compare
@jyn514 Ok, I think this should be ready for another review. There are a few unresolved threads:
I think the second and third ones should probably be left for future PRs. So, the first one is the main thread to be discussed. Or, if there's anything else you notice or have questions about, let me know! I can also try to split up this PR further if it would make it easier to review. |
Instead, return `Type::Infer` since compilation should fail anyway. That's how rustdoc handles `hir::TyKind::Err`s, so this just extends that behavior to `ty::Err`s when analyzing associated types. For some reason, the error is printed twice with rustdoc (though only once with rustc). I'm not sure why that is, but it's better than panicking. This commit also makes rustdoc fail early in the non-projection, non-error case, instead of returning a `Res::Err` that would likely cause rustdoc to panic later on. This change is originally from rust-lang#88379.
💥 Test timed out |
I don't understand why this one builder (
So is it hanging while compiling rustdoc? Other PRs in the queue have merged, so it seems like it's specific to this PR. I just don't understand how my changes could cause only one of the builders to time out. Maybe monomorphization is taking longer since I removed a few EDIT: Based on the build log timestamps, it seems it is indeed timing out while compiling the |
|
@bors retry Stopgap CI fix is in a roll up at the front of the queue. |
⌛ Testing commit ebbcafb with merge 6eca024aa731feb4347f21453353a31e59ac09b9... |
Looks like bors is likely to time out again, this time with Since the last issue was LLVM related, I checked before/after for the update to the final LLVM 13.0 (the most recent change I saw to |
💥 Test timed out |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (a8f2463): comparison url. Summary: This change led to moderate relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Cleanup various
clean
types.