Skip to content

Commit

Permalink
Rollup merge of rust-lang#59680 - DevQps:document-rustc-z-flag, r=cra…
Browse files Browse the repository at this point in the history
…mertj

Document the -Z flag to the rustc book

# Description

Changes:
- Added new documentation on the `-Z` flag of rustc in the command-line arguments section of the rustc book.

If I need to rephrase anything or if you have any improvements, please let me know! I deliberately did not create an exhaustive list of all options since they are likely to change over time and per toolchain version.

closes rust-lang#41142
  • Loading branch information
sanxiyn committed Apr 11, 2019
2 parents 96d700f + cdeb745 commit 632b11c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ This flag will set which lints should be set to the [deny level](lints/levels.ht

This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid).

## `-Z`: set unstable options

This flag will allow you to set unstable options of rustc. In order to set multiple options,
the -Z flag can be used multiple times. For example: `rustc -Z verbose -Z time`.
Specifying options with -Z is only available on nightly. To view all available options
run: `rustc -Z help`.

## `--cap-lints`: set the most restrictive lint level

This flag lets you 'cap' lints, for more, [see here](lints/levels.html#capping-lints).
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ fn usage(verbose: bool, include_unstable_options: bool) {
}
let message = "Usage: rustc [OPTIONS] INPUT";
let nightly_help = if nightly_options::is_nightly_build() {
"\n -Z help Print internal options for debugging rustc"
"\n -Z help Print unstable compiler options"
} else {
""
};
Expand Down Expand Up @@ -892,7 +892,7 @@ Available lint options:
}

fn describe_debug_flags() {
println!("\nAvailable debug options:\n");
println!("\nAvailable options:\n");
print_flag_list("-Z", config::DB_OPTIONS);
}

Expand Down

0 comments on commit 632b11c

Please sign in to comment.