Skip to content

Commit

Permalink
Finish rustdoc error improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jun 27, 2022
1 parent 70ced25 commit 768129d
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 31 deletions.
6 changes: 4 additions & 2 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ impl RenderOptions {
impl Options {
/// Parses the given command-line for options. If an error message or other early-return has
/// been printed, returns `Err` with the exit code.
pub(crate) fn from_matches(matches: &getopts::Matches, args: Vec<String>) -> Result<Options, i32> {
pub(crate) fn from_matches(
matches: &getopts::Matches,
args: Vec<String>,
) -> Result<Options, i32> {
let args = &args[1..];
// Check for unstable options.
nightly_options::check_nightly_options(matches, &opts());
Expand Down Expand Up @@ -432,7 +435,6 @@ impl Options {
}
return Err(0);
}
let (_lint_opts, _describe_lints, _lint_cap) = get_cmd_lint_options(matches, error_format);

if matches.free.is_empty() {
diag.struct_err("missing file operand").emit();
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make/issue-88756-default-output/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-include ../../run-make-fulldeps/tools.mk

all:
$(BARE_RUSTDOC) 2>&1 | diff - output-default.stdout
$(BARE_RUSTDOC) 2>&1 | sed -E 's@/nightly/|/beta/|/stable/|/1\.[0-9]+\.[0-9]+/@/$$CHANNEL/@g' | diff - output-default.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@ Options:

@path Read newline separated options from `path`

More information available at https://doc.rust-lang.org/nightly/rustdoc/what-is-rustdoc.html
More information available at https://doc.rust-lang.org/$CHANNEL/rustdoc/what-is-rustdoc.html
10 changes: 7 additions & 3 deletions src/test/run-make/issue-88756-opt-help/output-default.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
-W assume-incomplete-release=val -- make cfg(version) treat the current version as incomplete (default: no)
-W asm-comments=val -- generate comments into the assembly (may change behavior) (default: no)
-W assert-incr-state=val -- assert that the incremental cache is in given state: either `loaded` or `not-loaded`.
-W ast-json=val -- print the AST as JSON and halt (default: no)
-W ast-json-noexpand=val -- print the pre-expansion AST as JSON and halt (default: no)
-W binary-dep-depinfo=val -- include artifacts (sysroot, crate dependencies) used during compilation in dep-info (default: no)
-W borrowck=val -- select which borrowck is used (`mir` or `migrate`) (default: `migrate`)
-W branch-protection=val -- set options for branch target identification and pointer authentication on AArch64
-W cf-protection=val -- instrument control-flow architecture protection
-W cgu-partitioning-strategy=val -- the codegen unit partitioning strategy to use
Expand Down Expand Up @@ -133,12 +130,17 @@
for example: `-Z self-profile-events=default,query-keys`
all options: none, all, default, generic-activity, query-provider, query-cache-hit
query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes
-W self-profile-counter=val -- counter used by the self profiler (default: `wall-time`), one of:
`wall-time` (monotonic clock, i.e. `std::time::Instant`)
`instructions:u` (retired instructions, userspace-only)
`instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)
-W share-generics=val -- make the current crate share its generic instantiations
-W show-span=val -- show spans for compiler debugging (expr|pat|ty)
-W span-debug=val -- forward proc_macro::Span's `Debug` impl to `Span`
-W span-free-formats=val -- exclude spans when debug-printing compiler state (default: no)
-W src-hash-algorithm=val -- hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)
-W stack-protector=val -- control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)
-W strict-init-checks=val -- control if mem::uninitialized and mem::zeroed panic on more UB
-W strip=val -- tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)
-W split-dwarf-kind=val -- split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform)
(default: `split`)
Expand All @@ -164,6 +166,7 @@
-W time-passes=val -- measure time of each rustc pass (default: no)
-W tls-model=val -- choose the TLS model to use (`rustc --print tls-models` for details)
-W trace-macros=val -- for every macro invocation, print its name and arguments (default: no)
-W translate-remapped-path-to-local-path=val -- translate remapped paths into local paths when possible (default: yes)
-W trap-unreachable=val -- generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)
-W treat-err-as-bug=val -- treat error number `val` that occurs as bug
-W trim-diagnostic-paths=val -- in diagnostics, use heuristics to shorten paths referring to items
Expand All @@ -186,4 +189,5 @@
-W validate-mir=val -- validate MIR after each transformation
-W verbose=val -- in general, enable more debug printouts (default: no)
-W verify-llvm-ir=val -- verify LLVM IR (default: no)
-W virtual-function-elimination=val -- enables dead virtual function elimination optimization. Requires `-Clto[=[fat,yes]]`
-W wasi-exec-model=val -- whether to build a wasi command or reactor
Loading

0 comments on commit 768129d

Please sign in to comment.