-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Currently, the --unpretty switch, which dumps internal compiler IRs etc, requires -Zunstable-options. It should just be -Zunpretty.
Honestly I can't recall precisely how all this option code works, but here are a few pointers to what might need to be changed:
unpretty opt group:
rust/src/librustc/session/config.rs
Lines 1512 to 1519 in 0b90e4e
| opt::opt("", "unpretty", | |
| "Present the input source, unstable (and less-pretty) variants; | |
| valid types are any of the types for `--pretty`, as well as: | |
| `flowgraph=<nodeid>` (graphviz formatted flowgraph for node), | |
| `everybody_loops` (all function bodies replaced with `loop {}`), | |
| `hir` (the HIR), `hir,identified`, or | |
| `hir,typed` (HIR with types for each node).", | |
| "TYPE"), |
debugging options (-Z flags) are defined by this crazy macro:
rust/src/librustc/session/config.rs
Lines 1045 to 1239 in 0b90e4e
| options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, | |
| build_debugging_options, "Z", "debugging", | |
| DB_OPTIONS, db_type_desc, dbsetters, | |
| verbose: bool = (false, parse_bool, [UNTRACKED], | |
| "in general, enable more debug printouts"), | |
| span_free_formats: bool = (false, parse_bool, [UNTRACKED], | |
| "when debug-printing compiler state, do not include spans"), // o/w tests have closure@path | |
| identify_regions: bool = (false, parse_bool, [UNTRACKED], | |
| "make unnamed regions display as '# (where # is some non-ident unique id)"), | |
| emit_end_regions: bool = (false, parse_bool, [UNTRACKED], | |
| "emit EndRegion as part of MIR; enable transforms that solely process EndRegion"), | |
| borrowck: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| "select which borrowck is used (`ast`, `mir`, or `compare`)"), | |
| two_phase_borrows: bool = (false, parse_bool, [UNTRACKED], | |
| "use two-phase reserved/active distinction for `&mut` borrows in MIR borrowck"), | |
| time_passes: bool = (false, parse_bool, [UNTRACKED], | |
| "measure time of each rustc pass"), | |
| count_llvm_insns: bool = (false, parse_bool, | |
| [UNTRACKED_WITH_WARNING(true, | |
| "The output generated by `-Z count_llvm_insns` might not be reliable \ | |
| when used with incremental compilation")], | |
| "count where LLVM instrs originate"), | |
| time_llvm_passes: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true, | |
| "The output of `-Z time-llvm-passes` will only reflect timings of \ | |
| re-translated modules when used with incremental compilation" )], | |
| "measure time of each LLVM pass"), | |
| input_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "gather statistics about the input"), | |
| trans_stats: bool = (false, parse_bool, [UNTRACKED_WITH_WARNING(true, | |
| "The output of `-Z trans-stats` might not be accurate when incremental \ | |
| compilation is enabled")], | |
| "gather trans statistics"), | |
| asm_comments: bool = (false, parse_bool, [TRACKED], | |
| "generate comments into the assembly (may change behavior)"), | |
| no_verify: bool = (false, parse_bool, [TRACKED], | |
| "skip LLVM verification"), | |
| borrowck_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "gather borrowck statistics"), | |
| no_landing_pads: bool = (false, parse_bool, [TRACKED], | |
| "omit landing pads for unwinding"), | |
| fewer_names: bool = (false, parse_bool, [TRACKED], | |
| "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR)"), | |
| meta_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "gather metadata statistics"), | |
| print_link_args: bool = (false, parse_bool, [UNTRACKED], | |
| "print the arguments passed to the linker"), | |
| print_llvm_passes: bool = (false, parse_bool, [UNTRACKED], | |
| "prints the llvm optimization passes being run"), | |
| ast_json: bool = (false, parse_bool, [UNTRACKED], | |
| "print the AST as JSON and halt"), | |
| query_threads: Option<usize> = (None, parse_opt_uint, [UNTRACKED], | |
| "execute queries on a thread pool with N threads"), | |
| ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED], | |
| "print the pre-expansion AST as JSON and halt"), | |
| ls: bool = (false, parse_bool, [UNTRACKED], | |
| "list the symbols defined by a library crate"), | |
| save_analysis: bool = (false, parse_bool, [UNTRACKED], | |
| "write syntax and type analysis (in JSON format) information, in \ | |
| addition to normal output"), | |
| flowgraph_print_loans: bool = (false, parse_bool, [UNTRACKED], | |
| "include loan analysis data in --unpretty flowgraph output"), | |
| flowgraph_print_moves: bool = (false, parse_bool, [UNTRACKED], | |
| "include move analysis data in --unpretty flowgraph output"), | |
| flowgraph_print_assigns: bool = (false, parse_bool, [UNTRACKED], | |
| "include assignment analysis data in --unpretty flowgraph output"), | |
| flowgraph_print_all: bool = (false, parse_bool, [UNTRACKED], | |
| "include all dataflow analysis data in --unpretty flowgraph output"), | |
| print_region_graph: bool = (false, parse_bool, [UNTRACKED], | |
| "prints region inference graph. \ | |
| Use with RUST_REGION_GRAPH=help for more info"), | |
| parse_only: bool = (false, parse_bool, [UNTRACKED], | |
| "parse only; do not compile, assemble, or link"), | |
| no_trans: bool = (false, parse_bool, [TRACKED], | |
| "run all passes except translation; no output"), | |
| treat_err_as_bug: bool = (false, parse_bool, [TRACKED], | |
| "treat all errors that occur as bugs"), | |
| external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED], | |
| "show macro backtraces even for non-local macros"), | |
| continue_parse_after_error: bool = (false, parse_bool, [TRACKED], | |
| "attempt to recover from parse errors (experimental)"), | |
| incremental: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| "enable incremental compilation (experimental)"), | |
| incremental_queries: bool = (true, parse_bool, [UNTRACKED], | |
| "enable incremental compilation support for queries (experimental)"), | |
| incremental_info: bool = (false, parse_bool, [UNTRACKED], | |
| "print high-level information about incremental reuse (or the lack thereof)"), | |
| incremental_dump_hash: bool = (false, parse_bool, [UNTRACKED], | |
| "dump hash information in textual format to stdout"), | |
| incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED], | |
| "verify incr. comp. hashes of green query instances"), | |
| incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED], | |
| "ignore spans during ICH computation -- used for testing"), | |
| dump_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"), | |
| query_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| "enable queries of the dependency graph for regression testing"), | |
| profile_queries: bool = (false, parse_bool, [UNTRACKED], | |
| "trace and profile the queries of the incremental compilation framework"), | |
| profile_queries_and_keys: bool = (false, parse_bool, [UNTRACKED], | |
| "trace and profile the queries and keys of the incremental compilation framework"), | |
| no_analysis: bool = (false, parse_bool, [UNTRACKED], | |
| "parse and expand the source, but run no analysis"), | |
| extra_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED], | |
| "load extra plugins"), | |
| unstable_options: bool = (false, parse_bool, [UNTRACKED], | |
| "adds unstable command line options to rustc interface"), | |
| force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| "force overflow checks on or off"), | |
| trace_macros: bool = (false, parse_bool, [UNTRACKED], | |
| "for every macro invocation, print its name and arguments"), | |
| debug_macros: bool = (false, parse_bool, [TRACKED], | |
| "emit line numbers debug info inside macros"), | |
| enable_nonzeroing_move_hints: bool = (false, parse_bool, [TRACKED], | |
| "force nonzeroing move optimization on"), | |
| keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED], | |
| "don't clear the hygiene data after analysis"), | |
| keep_ast: bool = (false, parse_bool, [UNTRACKED], | |
| "keep the AST after lowering it to HIR"), | |
| show_span: Option<String> = (None, parse_opt_string, [TRACKED], | |
| "show spans for compiler debugging (expr|pat|ty)"), | |
| print_type_sizes: bool = (false, parse_bool, [UNTRACKED], | |
| "print layout information for each type encountered"), | |
| print_trans_items: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| "print the result of the translation item collection pass"), | |
| mir_opt_level: usize = (1, parse_uint, [TRACKED], | |
| "set the MIR optimization level (0-3, default: 1)"), | |
| mutable_noalias: bool = (false, parse_bool, [UNTRACKED], | |
| "emit noalias metadata for mutable references"), | |
| dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| "dump MIR state at various points in translation"), | |
| dump_mir_dir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| "the directory the MIR is dumped into"), | |
| dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], | |
| "in addition to `.mir` files, create graphviz `.dot` files"), | |
| dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED], | |
| "if set, exclude the pass number when dumping MIR (used in tests)"), | |
| mir_emit_validate: usize = (0, parse_uint, [TRACKED], | |
| "emit Validate MIR statements, interpreted e.g. by miri (0: do not emit; 1: if function \ | |
| contains unsafe block, only validate arguments; 2: always emit full validation)"), | |
| perf_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "print some performance-related statistics"), | |
| hir_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "print some statistics about AST and HIR"), | |
| mir_stats: bool = (false, parse_bool, [UNTRACKED], | |
| "print some statistics about MIR"), | |
| always_encode_mir: bool = (false, parse_bool, [TRACKED], | |
| "encode MIR of all functions into the crate metadata"), | |
| miri: bool = (false, parse_bool, [TRACKED], | |
| "check the miri const evaluator against the old ctfe"), | |
| osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], | |
| "pass `-install_name @rpath/...` to the macOS linker"), | |
| sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED], | |
| "Use a sanitizer"), | |
| linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED], | |
| "Linker flavor"), | |
| fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED], | |
| "set the optimization fuel quota for a crate"), | |
| print_fuel: Option<String> = (None, parse_opt_string, [TRACKED], | |
| "make Rustc print the total optimization fuel used by a crate"), | |
| remap_path_prefix_from: Vec<PathBuf> = (vec![], parse_pathbuf_push, [TRACKED], | |
| "add a source pattern to the file path remapping config"), | |
| remap_path_prefix_to: Vec<PathBuf> = (vec![], parse_pathbuf_push, [TRACKED], | |
| "add a mapping target to the file path remapping config"), | |
| force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], | |
| "force all crates to be `rustc_private` unstable"), | |
| pre_link_arg: Vec<String> = (vec![], parse_string_push, [UNTRACKED], | |
| "a single extra argument to prepend the linker invocation (can be used several times)"), | |
| pre_link_args: Option<Vec<String>> = (None, parse_opt_list, [UNTRACKED], | |
| "extra arguments to prepend to the linker invocation (space separated)"), | |
| profile: bool = (false, parse_bool, [TRACKED], | |
| "insert profiling code"), | |
| relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED], | |
| "choose which RELRO level to use"), | |
| nll: bool = (false, parse_bool, [UNTRACKED], | |
| "run the non-lexical lifetimes MIR pass"), | |
| nll_dump_cause: bool = (false, parse_bool, [UNTRACKED], | |
| "dump cause information when reporting errors from NLL"), | |
| trans_time_graph: bool = (false, parse_bool, [UNTRACKED], | |
| "generate a graphical HTML report of time spent in trans and LLVM"), | |
| thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| "enable ThinLTO when possible"), | |
| inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| "control whether #[inline] functions are in all cgus"), | |
| tls_model: Option<String> = (None, parse_opt_string, [TRACKED], | |
| "choose the TLS model to use (rustc --print tls-models for details)"), | |
| saturating_float_casts: bool = (false, parse_bool, [TRACKED], | |
| "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ | |
| the max/min integer respectively, and NaN is mapped to 0"), | |
| lower_128bit_ops: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| "rewrite operators on i128 and u128 into lang item calls (typically provided \ | |
| by compiler-builtins) so translation doesn't need to support them, | |
| overriding the default for the current target"), | |
| human_readable_cgu_names: bool = (false, parse_bool, [TRACKED], | |
| "generate human-readable, predictable names for codegen units"), | |
| } |
When editing this code, I usually try to find some comparable option and copy-and-paste the relevant code. 👅
hanna-kruppebluss
Metadata
Metadata
Assignees
Labels
E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.