-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Monday's round of rustdoc improvements #9636
Conversation
if !self.seen.contains(&item.source.filename) { | ||
self.emit_source(item.source.filename); | ||
if self.cx.include_sources && !self.seen.contains(&item.source.filename) { | ||
// If it turns out that we couldn't read this file, then we probably |
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.
Should this print a warning to the user? (i.e. if they're expecting sources, silently not getting them without an indication of why is unfortunate.)
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.
Not necessarily, if I'm distributing a doc.json
file I don't expect you to have the source.
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 think a warning would be good 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.
Updated to print one warning after giving up.
Pushed with comments addressed, plus some bonus extra fixes. |
@@ -15,19 +15,21 @@ | |||
|
|||
#[desc = "rustdoc, the Rust documentation extractor"]; | |||
#[license = "MIT/ASL2"]; | |||
#[crate_type = "lib"]; | |||
//#[crate_type = "lib"]; |
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.
Is this on purpose?
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.
hm no, although it makes it super nice for compiling by hand!
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.
re-pushed.
This modifies the command-line usage of rustdoc to intake its own JSON output as well as a rust source file. This also alters the command line from `rustdoc input file` to `rustdoc file` with the input/output formats specified as -r and -w, respectively. When using a JSON input, no passes or plugins are re-run over the json, instead the output is generated directly from the JSON that was provided. Passes and plugins are still run on rust source input, however.
When a key is pressed and held, this now does the OS-style repeating after a bit of a pause. Also fixes the width of search results to be correct (was changed beforehand and didn't catch this).
This takes the rendering time of source files for libstd from 12.5s to 0.1s, turns out write! calls the write function *a lot*
This is progress towards rust-lang#9611
self.seen.insert(item.source.filename.clone()); | ||
|
||
if !self.cx.include_sources { |
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.
This is backwards, right? Since we're in an if self.cx.include_sources && ... { ... }
block, it will never fire, and when you flip it, it will always fire.
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.
This variable is reset from the return value of emit_source
and as soon as cx.include_sources
is false it will remain false (the branch is never taken again).
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.
Oh, obviously. I'm bad at looking 2 lines up.
Commits have all the juicy details. Import thing to note in this pull request is that `rustdoc html crate.rs` becomes `rustdoc crate.rs`
[`default_numeric_fallback`] do not lint on constants fix rust-lang/rust-clippy#9632 changelog:[`default_numeric_fallback`] do not lint on constants
Commits have all the juicy details.
Import thing to note in this pull request is that
rustdoc html crate.rs
becomesrustdoc crate.rs