-
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
rustdoc: refactor: centralize all command-line argument parsing #55515
Conversation
This comment has been minimized.
This comment has been minimized.
324bd87
to
e1c04af
Compare
That simplifies the code a lot! r=me once CI passed. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r=GuillaumeGomez |
📌 Commit bdb8cb4553f914134e57c73197f3b34aa8ac14a6 has been approved by |
☔ The latest upstream changes (presumably #54543) made this pull request unmergeable. Please resolve the merge conflicts. |
bdb8cb4
to
297cfea
Compare
Well that was an intense rebase. @GuillaumeGomez can you take another look? I had to change around |
for &flag in removed_flags.iter() { | ||
if matches.opt_present(flag) { | ||
diag.struct_warn(&format!("the '{}' flag no longer functions", flag)) | ||
.warn("see CVE-2018-1000622") |
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.
All removed flags are linked to this CVE?
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.
Both of these flags are, yes. They showed a similar message that was printed with eprintln!()
, which was being checked in rust_input
.
Updated! |
Thanks! @bors: r+ |
📌 Commit 560a01c has been approved by |
rustdoc: refactor: centralize all command-line argument parsing This is something i've wanted to do for a while, since we keep having to add new arguments to places like `rust_input` or `core::run_core` whenever we add a new CLI flag or the like. Those functions have inflated up to 11-19, and in some cases hiding away the locations where some CLI flags were being parsed, obscuring their use. Now, we have a central place where all command-line configuration occurs, including argument validation. One note about the design: i grouped together all the arguments that `html::render::run` needed, so that i could pass them on from compilation in one lump instead of trying to thread through individual items or clone the entire blob ahead of time. One other thing this adds is that rustdoc also now recognizes all the `-Z` options that rustc does, since we were manually grabbing a few previously. Now we parse a full `DebuggingOptions` struct and hand it directly to rustc when scraping docs.
☀️ Test successful - status-appveyor, status-travis |
This is something i've wanted to do for a while, since we keep having to add new arguments to places like
rust_input
orcore::run_core
whenever we add a new CLI flag or the like. Those functions have inflated up to 11-19, and in some cases hiding away the locations where some CLI flags were being parsed, obscuring their use. Now, we have a central place where all command-line configuration occurs, including argument validation.One note about the design: i grouped together all the arguments that
html::render::run
needed, so that i could pass them on from compilation in one lump instead of trying to thread through individual items or clone the entire blob ahead of time.One other thing this adds is that rustdoc also now recognizes all the
-Z
options that rustc does, since we were manually grabbing a few previously. Now we parse a fullDebuggingOptions
struct and hand it directly to rustc when scraping docs.