-
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-json: discard non-local inherent impls for primitives #128385
Conversation
Please add a test (in |
This comment has been minimized.
This comment has been minimized.
@rustbot author |
5274509
to
cc0dc8d
Compare
There's still pollution in |
This comment has been minimized.
This comment has been minimized.
Amazing! What sort of size-reduction does that give? Also: This might be another way to test: |
cc0dc8d
to
f138bbb
Compare
The size of docs for 1 file containing just |
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.
While the changes to formats/cache.rs
are good, and I'd be happy to approve them, mixing cleanup and semantic changes makes it much more difficult to review (as I have to piece together what behaviour has changes, vs what's just nicer code).
In the future, I'd rather these changes were made in a seperate commit or PR.
@@ -0,0 +1,2 @@ | |||
//@ count "$.index[*]" 1 |
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'd be nice if this could link back to the original issue, and also add a comment of what it's testing. At the moment, the purpose of this test won't be clear when viewed without context.
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 also renamed the test to the_smallest.rs
, but I'm not sure if that's the most fitting name
src/librustdoc/formats/mod.rs
Outdated
@@ -43,8 +44,7 @@ impl Impl { | |||
// Returns true if this is an implementation on a "local" type, meaning: | |||
// the type is in the current crate, or the type and the trait are both | |||
// re-exported by the current crate. | |||
pub(crate) fn is_on_local_type(&self, cx: &Context<'_>) -> bool { | |||
let cache = cx.cache(); | |||
pub(crate) fn is_on_local_type(&self, cache: &Cache, tcx: TyCtxt<'_>) -> bool { |
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.
Why make this change? All the call-sites seem to have a Context
.
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.
At first I tried to use this function in the JsonRenderer, so I had to make it output-format-agnostic, but after I changed the approach to not require that function, I realised keeping it that way might be beneficial in the future: something that's not defined specifically for HTML output shouldn't rely on data structures defined for generating HTML
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.
Could you revert this?
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.
Would you accept such a change in a separate PR? possibly expanded if I find other cases of output-format-agnostic functionality relying on a specific output format
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 don't think so. As long as this method's only used in the HTML backend, I (personally) think it's fine to rely on HTML-specific helpers.
68af4a3
to
7ec2e5b
Compare
@rustbot review |
@rustbot author |
7ec2e5b
to
acaa817
Compare
acaa817
to
7499e21
Compare
@bors r+ |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#128385 (rustdoc-json: discard non-local inherent impls for primitives) - rust-lang#128559 (Don't re-elaborated already elaborated caller bounds in method probe) - rust-lang#128631 (handle crates when they are not specified for std docs) - rust-lang#128664 (Add `Debug` impls to API types in `rustc_codegen_ssa`) - rust-lang#128686 (fix the invalid argument type) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128385 - its-the-shrimp:fix_114039, r=aDotInTheVoid rustdoc-json: discard non-local inherent impls for primitives Fixes rust-lang#114039 at least it should r? `@aDotInTheVoid`
Fixes #114039
at least it should
r? @aDotInTheVoid