This option is deprecated and does nothing.
-## linker
+## code-model
-This flag controls which linker `rustc` invokes to link your code. It takes a
-path to the linker executable. If this flag is not specified, the linker will
-be inferred based on the target. See also the [linker-flavor](#linker-flavor)
-flag for another way to specify the linker.
+This option lets you choose which code model to use.
+
+To find the valid options for this flag, run `rustc --print code-models`.
+
+## codegen-units
+
+This flag controls how many code generation units the crate is split into. It
+takes an integer greater than 0.
+
+When a crate is split into multiple codegen units, LLVM is able to process
+them in parallel. Increasing parallelism may speed up compile times, but may
+also produce slower code. Setting this to 1 may improve the performance of
+generated code, but may be slower to compile.
+
+The default value, if not specified, is 16 for non-incremental builds. For
+incremental builds the default is 256 which allows caching to be more granular.
+
+## debug-assertions
+
+This flag lets you turn `cfg(debug_assertions)` [conditional
+compilation](../../reference/conditional-compilation.md#debug_assertions) on
+or off. It takes one of the following values:
+
+* `y`, `yes`, `on`, or no value: enable debug-assertions.
+* `n`, `no`, or `off`: disable debug-assertions.
+
+If not specified, debug assertions are automatically enabled only if the
+[opt-level](#opt-level) is 0.
+
+## debuginfo
+
+This flag controls the generation of debug information. It takes one of the
+following values:
+
+* `0`: no debug info at all (the default).
+* `1`: line tables only.
+* `2`: full debug info.
+
+Note: The [`-g` flag][option-g-debug] is an alias for `-C debuginfo=2`.
+
+## default-linker-libraries
+
+This flag controls whether or not the linker includes its default libraries.
+It takes one of the following values:
+
+* `y`, `yes`, `on`, or no value: include default libraries (the default).
+* `n`, `no`, or `off`: exclude default libraries.
+
+For example, for gcc flavor linkers, this issues the `-nodefaultlibs` flag to
+the linker.
+
+## extra-filename
+
+This option allows you to put extra data in each output filename. It takes a
+string to add as a suffix to the filename. See the [`--emit`
+flag][option-emit] for more information.
+
+## force-frame-pointers
+
+This flag forces the use of frame pointers. It takes one of the following
+values:
+
+* `y`, `yes`, `on`, or no value: force-enable frame pointers.
+* `n`, `no`, or `off`: do not force-enable frame pointers. This does
+ not necessarily mean frame pointers will be removed.
+
+The default behaviour, if frame pointers are not force-enabled, depends on the
+target.
+
+## incremental
+
+This flag allows you to enable incremental compilation, which allows `rustc`
+to save information after compiling a crate to be reused when recompiling the
+crate, improving re-compile times. This takes a path to a directory where
+incremental files will be stored.
+
+## inline-threshold
+
+This option lets you set the default threshold for inlining a function. It
+takes an unsigned integer as a value. Inlining is based on a cost model, where
+a higher threshold will allow more inlining.
+
+The default depends on the [opt-level](#opt-level):
+
+| opt-level | Threshold |
+|-----------|-----------|
+| 0 | N/A, only inlines always-inline functions |
+| 1 | N/A, only inlines always-inline functions and LLVM lifetime intrinsics |
+| 2 | 225 |
+| 3 | 275 |
+| s | 75 |
+| z | 25 |
## link-arg
This flag lets you append multiple extra arguments to the linker invocation. The
options should be separated by spaces.
+## link-dead-code
+
+This flag controls whether the linker will keep dead code. It takes one of
+the following values:
+
+* `y`, `yes`, `on`, or no value: keep dead code.
+* `n`, `no`, or `off`: remove dead code (the default).
+
+An example of when this flag might be useful is when trying to construct code coverage
+metrics.
+
+## linker
+
+This flag controls which linker `rustc` invokes to link your code. It takes a
+path to the linker executable. If this flag is not specified, the linker will
+be inferred based on the target. See also the [linker-flavor](#linker-flavor)
+flag for another way to specify the linker.
+
## linker-flavor
This flag controls the linker flavor used by `rustc`. If a linker is given with
[lld-flavor]: https://lld.llvm.org/Driver.html
-## link-dead-code
+## linker-plugin-lto
-This flag controls whether the linker will keep dead code. It takes one of
+This flag defers LTO optimizations to the linker. See
+[linker-plugin-LTO](../linker-plugin-lto.md) for more details. It takes one of
the following values:
-* `y`, `yes`, `on`, or no value: keep dead code.
-* `n`, `no`, or `off`: remove dead code (the default).
+* `y`, `yes`, `on`, or no value: enable linker plugin LTO.
+* `n`, `no`, or `off`: disable linker plugin LTO (the default).
+* A path to the linker plugin.
-An example of when this flag might be useful is when trying to construct code coverage
-metrics.
+## llvm-args
+
+This flag can be used to pass a list of arguments directly to LLVM.
+
+The list must be separated by spaces.
+
+Pass `--help` to see a list of options.
## lto
See also [linker-plugin-lto](#linker-plugin-lto) for cross-language LTO.
-## linker-plugin-lto
-
-This flag defers LTO optimizations to the linker. See
-[linker-plugin-LTO](../linker-plugin-lto.md) for more details. It takes one of
-the following values:
-
-* `y`, `yes`, `on`, or no value: enable linker plugin LTO.
-* `n`, `no`, or `off`: disable linker plugin LTO (the default).
-* A path to the linker plugin.
-
-## target-cpu
-
-This instructs `rustc` to generate code specifically for a particular processor.
-
-You can run `rustc --print target-cpus` to see the valid options to pass
-here. Additionally, `native` can be passed to use the processor of the host
-machine. Each target has a default base CPU.
-
-## target-feature
-
-Individual targets will support different features; this flag lets you control
-enabling or disabling a feature. Each feature should be prefixed with a `+` to
-enable it or `-` to disable it. Separate multiple features with commas.
-
-To see the valid options and an example of use, run `rustc --print
-target-features`.
+## metadata
-Using this flag is unsafe and might result in [undefined runtime
-behavior](../targets/known-issues.md).
+This option allows you to control the metadata used for symbol mangling. This
+takes a space-separated list of strings. Mangled symbols will incorporate a
+hash of the metadata. This may be used, for example, to differentiate symbols
+between two different versions of the same crate being linked.
-See also the [`target_feature`
-attribute](../../reference/attributes/codegen.md#the-target_feature-attribute)
-for controlling features per-function.
+## no-prepopulate-passes
-This also supports the feature `+crt-static` and `-crt-static` to control
-[static C runtime linkage](../../reference/linkage.html#static-and-dynamic-c-runtimes).
+This flag tells the pass manager to use an empty list of passes, instead of the
+usual pre-populated list of passes.
-Each target and [`target-cpu`](#target-cpu) has a default set of enabled
-features.
+## no-redzone
-## passes
+This flag allows you to disable [the
+red zone](https://en.wikipedia.org/wiki/Red_zone_\(computing\)). It takes one
+of the following values:
-This flag can be used to add extra [LLVM
-passes](http://llvm.org/docs/Passes.html) to the compilation.
+* `y`, `yes`, `on`, or no value: disable the red zone.
+* `n`, `no`, or `off`: enable the red zone.
-The list must be separated by spaces.
+The default behaviour, if the flag is not specified, depends on the target.
-See also the [`no-prepopulate-passes`](#no-prepopulate-passes) flag.
+## no-stack-check
-## llvm-args
+This option is deprecated and does nothing.
-This flag can be used to pass a list of arguments directly to LLVM.
+## no-vectorize-loops
-The list must be separated by spaces.
+This flag disables [loop
+vectorization](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer).
-Pass `--help` to see a list of options.
+## no-vectorize-slp
-## save-temps
+This flag disables vectorization using
+[superword-level
+parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer).
-This flag controls whether temporary files generated during compilation are
-deleted once compilation finishes. It takes one of the following values:
+## opt-level
-* `y`, `yes`, `on`, or no value: save temporary files.
-* `n`, `no`, or `off`: delete temporary files (the default).
+This flag controls the optimization level.
-## rpath
+* `0`: no optimizations, also turns on
+ [`cfg(debug_assertions)`](#debug-assertions) (the default).
+* `1`: basic optimizations.
+* `2`: some optimizations.
+* `3`: all optimizations.
+* `s`: optimize for binary size.
+* `z`: optimize for binary size, but also turn off loop vectorization.
-This flag controls whether [`rpath`](https://en.wikipedia.org/wiki/Rpath) is
-enabled. It takes one of the following values:
+Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`.
-* `y`, `yes`, `on`, or no value: enable rpath.
-* `n`, `no`, or `off`: disable rpath (the default).
+The default is `0`.
## overflow-checks
If not specified, overflow checks are enabled if
[debug-assertions](#debug-assertions) are enabled, disabled otherwise.
-## no-prepopulate-passes
-
-This flag tells the pass manager to use an empty list of passes, instead of the
-usual pre-populated list of passes.
+## panic
-## no-vectorize-loops
+This option lets you control what happens when the code panics.
-This flag disables [loop
-vectorization](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer).
+* `abort`: terminate the process upon panic
+* `unwind`: unwind the stack upon panic
-## no-vectorize-slp
+If not specified, the default depends on the target.
-This flag disables vectorization using
-[superword-level
-parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer).
+## passes
-## soft-float
+This flag can be used to add extra [LLVM
+passes](http://llvm.org/docs/Passes.html) to the compilation.
-This option controls whether `rustc` generates code that emulates floating
-point instructions in software. It takes one of the following values:
+The list must be separated by spaces.
-* `y`, `yes`, `on`, or no value: use soft floats.
-* `n`, `no`, or `off`: use hardware floats (the default).
+See also the [`no-prepopulate-passes`](#no-prepopulate-passes) flag.
## prefer-dynamic
* `y`, `yes`, `on`, or no value: use dynamic linking.
* `n`, `no`, or `off`: use static linking (the default).
-## no-redzone
+## profile-generate
-This flag allows you to disable [the
-red zone](https://en.wikipedia.org/wiki/Red_zone_\(computing\)). It takes one
-of the following values:
+This flag allows for creating instrumented binaries that will collect
+profiling data for use with profile-guided optimization (PGO). The flag takes
+an optional argument which is the path to a directory into which the
+instrumented binary will emit the collected data. See the chapter on
+[profile-guided optimization] for more information.
-* `y`, `yes`, `on`, or no value: disable the red zone.
-* `n`, `no`, or `off`: enable the red zone.
+## profile-use
-The default behaviour, if the flag is not specified, depends on the target.
+This flag specifies the profiling data file to be used for profile-guided
+optimization (PGO). The flag takes a mandatory argument which is the path
+to a valid `.profdata` file. See the chapter on
+[profile-guided optimization] for more information.
## relocation-model
To find the valid options for this flag, run `rustc --print relocation-models`.
-## code-model
-
-This option lets you choose which code model to use.
-
-To find the valid options for this flag, run `rustc --print code-models`.
-
-## metadata
-
-This option allows you to control the metadata used for symbol mangling. This
-takes a space-separated list of strings. Mangled symbols will incorporate a
-hash of the metadata. This may be used, for example, to differentiate symbols
-between two different versions of the same crate being linked.
-
-## extra-filename
-
-This option allows you to put extra data in each output filename. It takes a
-string to add as a suffix to the filename. See the [`--emit`
-flag][option-emit] for more information.
-
-## codegen-units
-
-This flag controls how many code generation units the crate is split into. It
-takes an integer greater than 0.
-
-When a crate is split into multiple codegen units, LLVM is able to process
-them in parallel. Increasing parallelism may speed up compile times, but may
-also produce slower code. Setting this to 1 may improve the performance of
-generated code, but may be slower to compile.
-
-The default value, if not specified, is 16 for non-incremental builds. For
-incremental builds the default is 256 which allows caching to be more granular.
-
## remark
This flag lets you print remarks for optimization passes.
`all` will remark on every pass.
-## no-stack-check
-
-This option is deprecated and does nothing.
-
-## debuginfo
-
-This flag controls the generation of debug information. It takes one of the
-following values:
-
-* `0`: no debug info at all (the default).
-* `1`: line tables only.
-* `2`: full debug info.
-
-Note: The [`-g` flag][option-g-debug] is an alias for `-C debuginfo=2`.
-
-## opt-level
-
-This flag controls the optimization level.
-
-* `0`: no optimizations, also turns on
- [`cfg(debug_assertions)`](#debug-assertions) (the default).
-* `1`: basic optimizations.
-* `2`: some optimizations.
-* `3`: all optimizations.
-* `s`: optimize for binary size.
-* `z`: optimize for binary size, but also turn off loop vectorization.
-
-Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`.
-
-The default is `0`.
-
-## debug-assertions
-
-This flag lets you turn `cfg(debug_assertions)` [conditional
-compilation](../../reference/conditional-compilation.md#debug_assertions) on
-or off. It takes one of the following values:
-
-* `y`, `yes`, `on`, or no value: enable debug-assertions.
-* `n`, `no`, or `off`: disable debug-assertions.
-
-If not specified, debug assertions are automatically enabled only if the
-[opt-level](#opt-level) is 0.
-
-## inline-threshold
-
-This option lets you set the default threshold for inlining a function. It
-takes an unsigned integer as a value. Inlining is based on a cost model, where
-a higher threshold will allow more inlining.
-
-The default depends on the [opt-level](#opt-level):
-
-| opt-level | Threshold |
-|-----------|-----------|
-| 0 | N/A, only inlines always-inline functions |
-| 1 | N/A, only inlines always-inline functions and LLVM lifetime intrinsics |
-| 2 | 225 |
-| 3 | 275 |
-| s | 75 |
-| z | 25 |
+## rpath
-## panic
+This flag controls whether [`rpath`](https://en.wikipedia.org/wiki/Rpath) is
+enabled. It takes one of the following values:
-This option lets you control what happens when the code panics.
+* `y`, `yes`, `on`, or no value: enable rpath.
+* `n`, `no`, or `off`: disable rpath (the default).
-* `abort`: terminate the process upon panic
-* `unwind`: unwind the stack upon panic
+## save-temps
-If not specified, the default depends on the target.
+This flag controls whether temporary files generated during compilation are
+deleted once compilation finishes. It takes one of the following values:
-## incremental
+* `y`, `yes`, `on`, or no value: save temporary files.
+* `n`, `no`, or `off`: delete temporary files (the default).
-This flag allows you to enable incremental compilation, which allows `rustc`
-to save information after compiling a crate to be reused when recompiling the
-crate, improving re-compile times. This takes a path to a directory where
-incremental files will be stored.
+## soft-float
-## profile-generate
+This option controls whether `rustc` generates code that emulates floating
+point instructions in software. It takes one of the following values:
-This flag allows for creating instrumented binaries that will collect
-profiling data for use with profile-guided optimization (PGO). The flag takes
-an optional argument which is the path to a directory into which the
-instrumented binary will emit the collected data. See the chapter on
-[profile-guided optimization] for more information.
+* `y`, `yes`, `on`, or no value: use soft floats.
+* `n`, `no`, or `off`: use hardware floats (the default).
-## profile-use
+## target-cpu
-This flag specifies the profiling data file to be used for profile-guided
-optimization (PGO). The flag takes a mandatory argument which is the path
-to a valid `.profdata` file. See the chapter on
-[profile-guided optimization] for more information.
+This instructs `rustc` to generate code specifically for a particular processor.
-## force-frame-pointers
+You can run `rustc --print target-cpus` to see the valid options to pass
+here. Additionally, `native` can be passed to use the processor of the host
+machine. Each target has a default base CPU.
-This flag forces the use of frame pointers. It takes one of the following
-values:
+## target-feature
-* `y`, `yes`, `on`, or no value: force-enable frame pointers.
-* `n`, `no`, or `off`: do not force-enable frame pointers. This does
- not necessarily mean frame pointers will be removed.
+Individual targets will support different features; this flag lets you control
+enabling or disabling a feature. Each feature should be prefixed with a `+` to
+enable it or `-` to disable it. Separate multiple features with commas.
-The default behaviour, if frame pointers are not force-enabled, depends on the
-target.
+To see the valid options and an example of use, run `rustc --print
+target-features`.
-## default-linker-libraries
+Using this flag is unsafe and might result in [undefined runtime
+behavior](../targets/known-issues.md).
-This flag controls whether or not the linker includes its default libraries.
-It takes one of the following values:
+See also the [`target_feature`
+attribute](../../reference/attributes/codegen.md#the-target_feature-attribute)
+for controlling features per-function.
-* `y`, `yes`, `on`, or no value: include default libraries (the default).
-* `n`, `no`, or `off`: exclude default libraries.
+This also supports the feature `+crt-static` and `-crt-static` to control
+[static C runtime linkage](../../reference/linkage.html#static-and-dynamic-c-runtimes).
-For example, for gcc flavor linkers, this issues the `-nodefaultlibs` flag to
-the linker.
+Each target and [`target-cpu`](#target-cpu) has a default set of enabled
+features.
## bitcode-in-rlib
use rustc_middle::middle::cstore;
use rustc_session::config::{build_configuration, build_session_options, to_crate_config};
use rustc_session::config::{rustc_optgroups, ErrorOutputType, ExternLocation, Options, Passes};
-use rustc_session::config::{ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
-use rustc_session::config::{Externs, OutputType, OutputTypes, SymbolManglingVersion};
+use rustc_session::config::{CFGuard, ExternEntry, LinkerPluginLto, LtoCli, SwitchWithOptPath};
+use rustc_session::config::{Externs, OutputType, OutputTypes, Sanitizer, SymbolManglingVersion};
use rustc_session::getopts;
use rustc_session::lint::Level;
use rustc_session::search_paths::SearchPath;
use rustc_session::{build_session, Session};
use rustc_span::edition::{Edition, DEFAULT_EDITION};
use rustc_span::symbol::sym;
-use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel};
+use rustc_span::SourceFileHashAlgorithm;
+use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel};
use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator;
use std::path::PathBuf;
let reference = Options::default();
let mut opts = Options::default();
- // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
- opts.cg.ar = String::from("abc");
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.linker = Some(PathBuf::from("linker"));
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.link_args = vec![String::from("abc"), String::from("def")];
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.link_dead_code = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.rpath = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.extra_filename = String::from("extra-filename");
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.codegen_units = Some(42);
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.remark = Passes::Some(vec![String::from("pass1"), String::from("pass2")]);
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.save_temps = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts.cg.incremental = Some(String::from("abc"));
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- // Make sure changing a [TRACKED] option changes the hash
- opts = reference.clone();
- opts.cg.lto = LtoCli::Fat;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.target_cpu = Some(String::from("abc"));
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.target_feature = String::from("all the features, all of them");
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.passes = vec![String::from("1"), String::from("2")];
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.llvm_args = vec![String::from("1"), String::from("2")];
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.overflow_checks = Some(true);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.no_prepopulate_passes = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.no_vectorize_loops = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.no_vectorize_slp = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.soft_float = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.prefer_dynamic = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.no_redzone = Some(true);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.relocation_model = Some(String::from("relocation model"));
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.code_model = Some(String::from("code model"));
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.tls_model = Some(String::from("tls model"));
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.profile_generate = SwitchWithOptPath::Enabled(None);
- assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.profile_use = Some(PathBuf::from("abc"));
- assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.metadata = vec![String::from("A"), String::from("B")];
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.debuginfo = 0xdeadbeef;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.debuginfo = 0xba5eba11;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.force_frame_pointers = Some(false);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.debug_assertions = Some(true);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.inline_threshold = Some(0xf007ba11);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+ macro_rules! untracked {
+ ($name: ident, $non_default_value: expr) => {
+ opts.cg.$name = $non_default_value;
+ assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+ };
+ }
- opts = reference.clone();
- opts.cg.panic = Some(PanicStrategy::Abort);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+ // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
+ // This list is in alphabetical order.
+ untracked!(ar, String::from("abc"));
+ untracked!(codegen_units, Some(42));
+ untracked!(default_linker_libraries, true);
+ untracked!(extra_filename, String::from("extra-filename"));
+ untracked!(incremental, Some(String::from("abc")));
+ // `link_arg` is omitted because it just forwards to `link_args`.
+ untracked!(link_args, vec![String::from("abc"), String::from("def")]);
+ untracked!(link_dead_code, true);
+ untracked!(linker, Some(PathBuf::from("linker")));
+ untracked!(linker_flavor, Some(LinkerFlavor::Gcc));
+ untracked!(no_stack_check, true);
+ untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
+ untracked!(rpath, true);
+ untracked!(save_temps, true);
+
+ macro_rules! tracked {
+ ($name: ident, $non_default_value: expr) => {
+ opts = reference.clone();
+ opts.cg.$name = $non_default_value;
+ assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+ };
+ }
- opts = reference.clone();
- opts.cg.linker_plugin_lto = LinkerPluginLto::LinkerPluginAuto;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.cg.bitcode_in_rlib = false;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+ // Make sure that changing a [TRACKED] option changes the hash.
+ // This list is in alphabetical order.
+ tracked!(bitcode_in_rlib, false);
+ tracked!(code_model, Some(String::from("code model")));
+ tracked!(debug_assertions, Some(true));
+ tracked!(debuginfo, 0xdeadbeef);
+ tracked!(force_frame_pointers, Some(false));
+ tracked!(inline_threshold, Some(0xf007ba11));
+ tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
+ tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
+ tracked!(lto, LtoCli::Fat);
+ tracked!(metadata, vec![String::from("A"), String::from("B")]);
+ tracked!(no_prepopulate_passes, true);
+ tracked!(no_redzone, Some(true));
+ tracked!(no_vectorize_loops, true);
+ tracked!(no_vectorize_slp, true);
+ tracked!(opt_level, "3".to_string());
+ tracked!(overflow_checks, Some(true));
+ tracked!(panic, Some(PanicStrategy::Abort));
+ tracked!(passes, vec![String::from("1"), String::from("2")]);
+ tracked!(prefer_dynamic, true);
+ tracked!(profile_generate, SwitchWithOptPath::Enabled(None));
+ tracked!(profile_use, Some(PathBuf::from("abc")));
+ tracked!(relocation_model, Some(String::from("relocation model")));
+ tracked!(soft_float, true);
+ tracked!(target_cpu, Some(String::from("abc")));
+ tracked!(target_feature, String::from("all the features, all of them"));
}
#[test]
let reference = Options::default();
let mut opts = Options::default();
- // Make sure the changing an [UNTRACKED] option leaves the hash unchanged
- opts.debugging_opts.verbose = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.time_passes = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.time_llvm_passes = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.input_stats = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.borrowck_stats = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.meta_stats = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.print_link_args = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.print_llvm_passes = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.ast_json = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.ast_json_noexpand = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.ls = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.save_analysis = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.print_region_graph = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.parse_only = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.dump_dep_graph = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.query_dep_graph = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.no_analysis = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.unstable_options = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.trace_macros = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.keep_hygiene_data = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.print_mono_items = Some(String::from("abc"));
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.dump_mir = Some(String::from("abc"));
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.dump_mir_dir = String::from("abc");
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.dump_mir_graphviz = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
- opts.debugging_opts.dump_mir_dataflow = true;
- assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
-
- // Make sure changing a [TRACKED] option changes the hash
- opts = reference.clone();
- opts.debugging_opts.asm_comments = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.verify_llvm_ir = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.no_landing_pads = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.fewer_names = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.no_codegen = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.treat_err_as_bug = Some(1);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.report_delayed_bugs = true;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.force_overflow_checks = Some(true);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.show_span = Some(String::from("abc"));
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.mir_opt_level = 3;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.relro_level = Some(RelroLevel::Full);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.merge_functions = Some(MergeFunctions::Disabled);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.allow_features = Some(vec![String::from("lang_items")]);
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
-
- opts = reference.clone();
- opts.debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
- assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
+ macro_rules! untracked {
+ ($name: ident, $non_default_value: expr) => {
+ opts.debugging_opts.$name = $non_default_value;
+ assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+ };
+ }
+
+ // Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
+ // This list is in alphabetical order.
+ untracked!(ast_json, true);
+ untracked!(ast_json_noexpand, true);
+ untracked!(borrowck, String::from("other"));
+ untracked!(borrowck_stats, true);
+ untracked!(control_flow_guard, CFGuard::Checks);
+ untracked!(deduplicate_diagnostics, true);
+ untracked!(dep_tasks, true);
+ untracked!(dont_buffer_diagnostics, true);
+ untracked!(dump_dep_graph, true);
+ untracked!(dump_mir, Some(String::from("abc")));
+ untracked!(dump_mir_dataflow, true);
+ untracked!(dump_mir_dir, String::from("abc"));
+ untracked!(dump_mir_exclude_pass_number, true);
+ untracked!(dump_mir_graphviz, true);
+ untracked!(emit_stack_sizes, true);
+ untracked!(hir_stats, true);
+ untracked!(identify_regions, true);
+ untracked!(incremental_ignore_spans, true);
+ untracked!(incremental_info, true);
+ untracked!(incremental_verify_ich, true);
+ untracked!(input_stats, true);
+ untracked!(keep_hygiene_data, true);
+ untracked!(link_native_libraries, false);
+ untracked!(llvm_time_trace, true);
+ untracked!(ls, true);
+ untracked!(macro_backtrace, true);
+ untracked!(meta_stats, true);
+ untracked!(nll_facts, true);
+ untracked!(no_analysis, true);
+ untracked!(no_interleave_lints, true);
+ untracked!(no_leak_check, true);
+ untracked!(no_parallel_llvm, true);
+ untracked!(parse_only, true);
+ untracked!(perf_stats, true);
+ untracked!(polonius, true);
+ // `pre_link_arg` is omitted because it just forwards to `pre_link_args`.
+ untracked!(pre_link_args, vec![String::from("abc"), String::from("def")]);
+ untracked!(print_link_args, true);
+ untracked!(print_llvm_passes, true);
+ untracked!(print_mono_items, Some(String::from("abc")));
+ untracked!(print_region_graph, true);
+ untracked!(print_type_sizes, true);
+ untracked!(query_dep_graph, true);
+ untracked!(query_stats, true);
+ untracked!(save_analysis, true);
+ untracked!(self_profile, SwitchWithOptPath::Enabled(None));
+ untracked!(self_profile_events, Some(vec![String::new()]));
+ untracked!(span_free_formats, true);
+ untracked!(terminal_width, Some(80));
+ untracked!(threads, 99);
+ untracked!(time, true);
+ untracked!(time_llvm_passes, true);
+ untracked!(time_passes, true);
+ untracked!(trace_macros, true);
+ untracked!(ui_testing, true);
+ untracked!(unpretty, Some("expanded".to_string()));
+ untracked!(unstable_options, true);
+ untracked!(verbose, true);
+
+ macro_rules! tracked {
+ ($name: ident, $non_default_value: expr) => {
+ opts = reference.clone();
+ opts.debugging_opts.$name = $non_default_value;
+ assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
+ };
+ }
+
+ // Make sure that changing a [TRACKED] option changes the hash.
+ // This list is in alphabetical order.
+ tracked!(allow_features, Some(vec![String::from("lang_items")]));
+ tracked!(always_encode_mir, true);
+ tracked!(asm_comments, true);
+ tracked!(binary_dep_depinfo, true);
+ tracked!(codegen_backend, Some("abc".to_string()));
+ tracked!(crate_attr, vec!["abc".to_string()]);
+ tracked!(debug_macros, true);
+ tracked!(dep_info_omit_d_target, true);
+ tracked!(dual_proc_macros, true);
+ tracked!(embed_bitcode, true);
+ tracked!(fewer_names, true);
+ tracked!(force_overflow_checks, Some(true));
+ tracked!(force_unstable_if_unmarked, true);
+ tracked!(fuel, Some(("abc".to_string(), 99)));
+ tracked!(human_readable_cgu_names, true);
+ tracked!(inline_in_all_cgus, Some(true));
+ tracked!(insert_sideeffect, true);
+ tracked!(instrument_mcount, true);
+ tracked!(link_only, true);
+ tracked!(merge_functions, Some(MergeFunctions::Disabled));
+ tracked!(mir_emit_retag, true);
+ tracked!(mir_opt_level, 3);
+ tracked!(mutable_noalias, true);
+ tracked!(new_llvm_pass_manager, true);
+ tracked!(no_codegen, true);
+ tracked!(no_generate_arange_section, true);
+ tracked!(no_landing_pads, true);
+ tracked!(no_link, true);
+ tracked!(no_profiler_runtime, true);
+ tracked!(osx_rpath_install_name, true);
+ tracked!(panic_abort_tests, true);
+ tracked!(plt, Some(true));
+ tracked!(print_fuel, Some("abc".to_string()));
+ tracked!(profile, true);
+ tracked!(relro_level, Some(RelroLevel::Full));
+ tracked!(report_delayed_bugs, true);
+ tracked!(run_dsymutil, false);
+ tracked!(sanitizer, Some(Sanitizer::Address));
+ tracked!(sanitizer_memory_track_origins, 2);
+ tracked!(sanitizer_recover, vec![Sanitizer::Address]);
+ tracked!(saturating_float_casts, true);
+ tracked!(share_generics, Some(true));
+ tracked!(show_span, Some(String::from("abc")));
+ tracked!(src_hash_algorithm, Some(SourceFileHashAlgorithm::Sha1));
+ tracked!(strip_debuginfo_if_disabled, true);
+ tracked!(symbol_mangling_version, SymbolManglingVersion::V0);
+ tracked!(teach, true);
+ tracked!(thinlto, Some(true));
+ tracked!(tls_model, Some(String::from("tls model")));
+ tracked!(treat_err_as_bug, Some(1));
+ tracked!(unleash_the_miri_inside_of_you, true);
+ tracked!(verify_llvm_ir, true);
}
#[test]
options! {CodegenOptions, CodegenSetter, basic_codegen_options,
build_codegen_options, "C", "codegen",
CG_OPTIONS, cg_type_desc, cgsetters,
+
+ // This list is in alphabetical order.
+ //
+ // If you add a new option, please update:
+ // - src/librustc_interface/tests.rs
+ // - src/doc/rustc/src/codegen-options/index.md
+
ar: String = (String::new(), parse_string, [UNTRACKED],
"this option is deprecated and does nothing"),
- linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
- "system linker to link outputs with"),
+ bitcode_in_rlib: bool = (true, parse_bool, [TRACKED],
+ "emit bitcode in rlibs (default: yes)"),
+ code_model: Option<String> = (None, parse_opt_string, [TRACKED],
+ "choose the code model to use (`rustc --print code-models` for details)"),
+ codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
+ "divide crate into N units to optimize in parallel"),
+ debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "explicitly enable the `cfg(debug_assertions)` directive"),
+ debuginfo: usize = (0, parse_uint, [TRACKED],
+ "debug info emission level (0 = no debug info, 1 = line tables only, \
+ 2 = full debug info with variable and type information; default: 0)"),
+ default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
+ "allow the linker to link its default libraries (default: no)"),
+ extra_filename: String = (String::new(), parse_string, [UNTRACKED],
+ "extra data to put in each output filename"),
+ force_frame_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "force use of the frame pointers"),
+ incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
+ "enable incremental compilation"),
+ inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
+ "set the threshold for inlining a function"),
link_arg: (/* redirected to link_args */) = ((), parse_string_push, [UNTRACKED],
"a single extra argument to append to the linker invocation (can be used several times)"),
link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
"extra arguments to append to the linker invocation (space separated)"),
link_dead_code: bool = (false, parse_bool, [UNTRACKED],
"keep dead code at link time (useful for code coverage) (default: no)"),
- lto: LtoCli = (LtoCli::Unspecified, parse_lto, [TRACKED],
- "perform LLVM link-time optimizations"),
- target_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
- "select target processor (`rustc --print target-cpus` for details)"),
- target_feature: String = (String::new(), parse_string, [TRACKED],
- "target specific attributes. (`rustc --print target-features` for details). \
- This feature is unsafe."),
- passes: Vec<String> = (Vec::new(), parse_list, [TRACKED],
- "a list of extra LLVM passes to run (space separated)"),
+ linker: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED],
+ "system linker to link outputs with"),
+ linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
+ "linker flavor"),
+ linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
+ parse_linker_plugin_lto, [TRACKED],
+ "generate build artifacts that are compatible with linker-based LTO"),
llvm_args: Vec<String> = (Vec::new(), parse_list, [TRACKED],
"a list of arguments to pass to LLVM (space separated)"),
- save_temps: bool = (false, parse_bool, [UNTRACKED],
- "save all temporary output files during compilation (default: no)"),
- rpath: bool = (false, parse_bool, [UNTRACKED],
- "set rpath values in libs/exes (default: no)"),
- overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
- "use overflow checks for integer arithmetic"),
+ lto: LtoCli = (LtoCli::Unspecified, parse_lto, [TRACKED],
+ "perform LLVM link-time optimizations"),
+ metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
+ "metadata to mangle symbol names with"),
no_prepopulate_passes: bool = (false, parse_no_flag, [TRACKED],
"give an empty list of passes to the pass manager"),
- no_vectorize_loops: bool = (false, parse_no_flag, [TRACKED],
- "disable loop vectorization optimization passes"),
- no_vectorize_slp: bool = (false, parse_no_flag, [TRACKED],
- "disable LLVM's SLP vectorization pass"),
- soft_float: bool = (false, parse_bool, [TRACKED],
- "use soft float ABI (*eabihf targets only) (default: no)"),
- prefer_dynamic: bool = (false, parse_bool, [TRACKED],
- "prefer dynamic linking to static linking (default: no)"),
no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED],
"disable the use of the redzone"),
- relocation_model: Option<String> = (None, parse_opt_string, [TRACKED],
- "choose the relocation model to use (`rustc --print relocation-models` for details)"),
- code_model: Option<String> = (None, parse_opt_string, [TRACKED],
- "choose the code model to use (`rustc --print code-models` for details)"),
- metadata: Vec<String> = (Vec::new(), parse_list, [TRACKED],
- "metadata to mangle symbol names with"),
- extra_filename: String = (String::new(), parse_string, [UNTRACKED],
- "extra data to put in each output filename"),
- codegen_units: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
- "divide crate into N units to optimize in parallel"),
- remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
- "print remarks for these optimization passes (space separated, or \"all\")"),
no_stack_check: bool = (false, parse_no_flag, [UNTRACKED],
"this option is deprecated and does nothing"),
- debuginfo: usize = (0, parse_uint, [TRACKED],
- "debug info emission level (0 = no debug info, 1 = line tables only, \
- 2 = full debug info with variable and type information; default: 0)"),
+ no_vectorize_loops: bool = (false, parse_no_flag, [TRACKED],
+ "disable loop vectorization optimization passes"),
+ no_vectorize_slp: bool = (false, parse_no_flag, [TRACKED],
+ "disable LLVM's SLP vectorization pass"),
opt_level: String = ("0".to_string(), parse_string, [TRACKED],
"optimization level (0-3, s, or z; default: 0)"),
- force_frame_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED],
- "force use of the frame pointers"),
- debug_assertions: Option<bool> = (None, parse_opt_bool, [TRACKED],
- "explicitly enable the `cfg(debug_assertions)` directive"),
- inline_threshold: Option<usize> = (None, parse_opt_uint, [TRACKED],
- "set the threshold for inlining a function"),
- panic: Option<PanicStrategy> = (None, parse_panic_strategy,
- [TRACKED], "panic strategy to compile crate with"),
- incremental: Option<String> = (None, parse_opt_string, [UNTRACKED],
- "enable incremental compilation"),
- default_linker_libraries: bool = (false, parse_bool, [UNTRACKED],
- "allow the linker to link its default libraries (default: no)"),
- linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
- "linker flavor"),
- linker_plugin_lto: LinkerPluginLto = (LinkerPluginLto::Disabled,
- parse_linker_plugin_lto, [TRACKED],
- "generate build artifacts that are compatible with linker-based LTO"),
+ overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "use overflow checks for integer arithmetic"),
+ panic: Option<PanicStrategy> = (None, parse_panic_strategy, [TRACKED],
+ "panic strategy to compile crate with"),
+ passes: Vec<String> = (Vec::new(), parse_list, [TRACKED],
+ "a list of extra LLVM passes to run (space separated)"),
+ prefer_dynamic: bool = (false, parse_bool, [TRACKED],
+ "prefer dynamic linking to static linking (default: no)"),
profile_generate: SwitchWithOptPath = (SwitchWithOptPath::Disabled,
parse_switch_with_opt_path, [TRACKED],
"compile the program with profiling instrumentation"),
profile_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
"use the given `.profdata` file for profile-guided optimization"),
- bitcode_in_rlib: bool = (true, parse_bool, [TRACKED],
- "emit bitcode in rlibs (default: yes)"),
+ relocation_model: Option<String> = (None, parse_opt_string, [TRACKED],
+ "choose the relocation model to use (`rustc --print relocation-models` for details)"),
+ remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
+ "print remarks for these optimization passes (space separated, or \"all\")"),
+ rpath: bool = (false, parse_bool, [UNTRACKED],
+ "set rpath values in libs/exes (default: no)"),
+ save_temps: bool = (false, parse_bool, [UNTRACKED],
+ "save all temporary output files during compilation (default: no)"),
+ soft_float: bool = (false, parse_bool, [TRACKED],
+ "use soft float ABI (*eabihf targets only) (default: no)"),
+ target_cpu: Option<String> = (None, parse_opt_string, [TRACKED],
+ "select target processor (`rustc --print target-cpus` for details)"),
+ target_feature: String = (String::new(), parse_string, [TRACKED],
+ "target specific attributes. (`rustc --print target-features` for details). \
+ This feature is unsafe."),
+
+ // This list is in alphabetical order.
+ //
+ // If you add a new option, please update:
+ // - src/librustc_interface/tests.rs
+ // - src/doc/rustc/src/codegen-options/index.md
}
options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
build_debugging_options, "Z", "debugging",
DB_OPTIONS, db_type_desc, dbsetters,
- codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
- "the backend to use"),
- verbose: bool = (false, parse_bool, [UNTRACKED],
- "in general, enable more debug printouts (default: no)"),
- // o/w tests have closure@path
- span_free_formats: bool = (false, parse_bool, [UNTRACKED],
- "exclude spans when debug-printing compiler state (default: no)"),
- identify_regions: bool = (false, parse_bool, [UNTRACKED],
- "display unnamed regions as `'<id>`, using a non-ident unique id (default: no)"),
- borrowck: String = ("migrate".to_string(), parse_string, [UNTRACKED],
- "select which borrowck is used (`mir` or `migrate`) (default: `migrate`)"),
- time_passes: bool = (false, parse_bool, [UNTRACKED],
- "measure time of each rustc pass (default: no)"),
- time: bool = (false, parse_bool, [UNTRACKED],
- "measure time of rustc processes (default: no)"),
- time_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
- "measure time of each LLVM pass (default: no)"),
- llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],
- "generate JSON tracing data file from LLVM data (default: no)"),
- input_stats: bool = (false, parse_bool, [UNTRACKED],
- "gather statistics about the input (default: no)"),
+
+ // This list is in alphabetical order.
+ //
+ // If you add a new option, please update:
+ // - src/librustc_interface/tests.rs
+
+ allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED],
+ "only allow the listed language features to be enabled in code (space separated)"),
+ always_encode_mir: bool = (false, parse_bool, [TRACKED],
+ "encode MIR of all functions into the crate metadata (default: no)"),
asm_comments: bool = (false, parse_bool, [TRACKED],
"generate comments into the assembly (may change behavior) (default: no)"),
- verify_llvm_ir: bool = (false, parse_bool, [TRACKED],
- "verify LLVM IR (default: no)"),
- borrowck_stats: bool = (false, parse_bool, [UNTRACKED],
- "gather borrowck statistics (default: no)"),
- no_landing_pads: bool = (false, parse_no_flag, [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) \
- (default: no)"),
- meta_stats: bool = (false, parse_bool, [UNTRACKED],
- "gather metadata statistics (default: no)"),
- print_link_args: bool = (false, parse_bool, [UNTRACKED],
- "print the arguments passed to the linker (default: no)"),
- print_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
- "print the LLVM optimization passes being run (default: no)"),
ast_json: bool = (false, parse_bool, [UNTRACKED],
"print the AST as JSON and halt (default: no)"),
- // We default to 1 here since we want to behave like
- // a sequential compiler for now. This'll likely be adjusted
- // in the future. Note that -Zthreads=0 is the way to get
- // the num_cpus behavior.
- threads: usize = (1, parse_threads, [UNTRACKED],
- "use a thread pool with N threads"),
ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED],
"print the pre-expansion AST as JSON and halt (default: no)"),
- ls: bool = (false, parse_bool, [UNTRACKED],
- "list the symbols defined by a library crate (default: no)"),
- save_analysis: bool = (false, parse_bool, [UNTRACKED],
- "write syntax and type analysis (in JSON format) information, in \
- addition to normal output (default: no)"),
- print_region_graph: bool = (false, parse_bool, [UNTRACKED],
- "prints region inference graph. \
- Use with RUST_REGION_GRAPH=help for more info (default: no)"),
- parse_only: bool = (false, parse_bool, [UNTRACKED],
- "parse only; do not compile, assemble, or link (default: no)"),
- dual_proc_macros: bool = (false, parse_bool, [TRACKED],
- "load proc macros for both target and host, but only link to the target (default: no)"),
- no_codegen: bool = (false, parse_no_flag, [TRACKED],
- "run all passes except codegen; no output"),
- treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED],
- "treat error number `val` that occurs as bug"),
- report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
- "immediately print bugs registered with `delay_span_bug` (default: no)"),
- macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
- "show macro backtraces (default: no)"),
- teach: bool = (false, parse_bool, [TRACKED],
- "show extended diagnostic help (default: no)"),
- terminal_width: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
- "set the current terminal width"),
- panic_abort_tests: bool = (false, parse_bool, [TRACKED],
- "support compiling tests with panic=abort (default: no)"),
+ binary_dep_depinfo: bool = (false, parse_bool, [TRACKED],
+ "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \
+ (default: no)"),
+ borrowck: String = ("migrate".to_string(), parse_string, [UNTRACKED],
+ "select which borrowck is used (`mir` or `migrate`) (default: `migrate`)"),
+ borrowck_stats: bool = (false, parse_bool, [UNTRACKED],
+ "gather borrowck statistics (default: no)"),
+ codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
+ "the backend to use"),
+ control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [UNTRACKED],
+ "use Windows Control Flow Guard (`disabled`, `nochecks` or `checks`)"),
+ crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
+ "inject the given attribute in the crate"),
+ debug_macros: bool = (false, parse_bool, [TRACKED],
+ "emit line numbers debug info inside macros (default: no)"),
+ deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED],
+ "deduplicate identical diagnostics (default: yes)"),
+ dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
+ "in dep-info output, omit targets for tracking dependencies of the dep-info files \
+ themselves (default: no)"),
dep_tasks: bool = (false, parse_bool, [UNTRACKED],
"print tasks that execute and the color their dep node gets (requires debug build) \
(default: no)"),
- incremental_info: bool = (false, parse_bool, [UNTRACKED],
- "print high-level information about incremental reuse (or the lack thereof) \
+ dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
+ "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
(default: no)"),
- incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
- "verify incr. comp. hashes of green query instances (default: no)"),
- incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED],
- "ignore spans during ICH computation -- used for testing (default: no)"),
- instrument_mcount: bool = (false, parse_bool, [TRACKED],
- "insert function instrument code for mcount-based tracing (default: no)"),
+ dual_proc_macros: bool = (false, parse_bool, [TRACKED],
+ "load proc macros for both target and host, but only link to the target (default: no)"),
dump_dep_graph: bool = (false, parse_bool, [UNTRACKED],
"dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) \
(default: no)"),
- query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
- "enable queries of the dependency graph for regression testing (default: no)"),
- no_analysis: bool = (false, parse_no_flag, [UNTRACKED],
- "parse and expand the source, but run no analysis"),
- unstable_options: bool = (false, parse_bool, [UNTRACKED],
- "adds unstable command line options to rustc interface (default: no)"),
- 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 (default: no)"),
- debug_macros: bool = (false, parse_bool, [TRACKED],
- "emit line numbers debug info inside macros (default: no)"),
- no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
- "omit DWARF address ranges that give faster lookups"),
- keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
- "keep hygiene data after analysis (default: no)"),
- 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 (default: no)"),
- print_mono_items: Option<String> = (None, parse_opt_string, [UNTRACKED],
- "print the result of the monomorphization collection pass"),
- mir_opt_level: usize = (1, parse_uint, [TRACKED],
- "MIR optimization level (0-3; default: 1)"),
- mutable_noalias: bool = (false, parse_bool, [TRACKED],
- "emit noalias metadata for mutable references (default: no)"),
dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
"dump MIR state to file.
`val` is used to select which passes and functions to dump. For example:
`foo` matches all passes for functions whose name contains 'foo',
`foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo',
`foo | bar` all passes for function names containing 'foo' or 'bar'."),
-
+ dump_mir_dataflow: bool = (false, parse_bool, [UNTRACKED],
+ "in addition to `.mir` files, create graphviz `.dot` files with dataflow results \
+ (default: no)"),
dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED],
"the directory the MIR is dumped into (default: `mir_dump`)"),
- dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],
- "in addition to `.mir` files, create graphviz `.dot` files (default: no)"),
- dump_mir_dataflow: bool = (false, parse_bool, [UNTRACKED],
- "in addition to `.mir` files, create graphviz `.dot` files with dataflow results (default: no)"),
dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
"exclude the pass number when dumping MIR (used in tests) (default: no)"),
- mir_emit_retag: bool = (false, parse_bool, [TRACKED],
- "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
- (default: no)"),
- perf_stats: bool = (false, parse_bool, [UNTRACKED],
- "print some performance-related statistics (default: no)"),
- query_stats: bool = (false, parse_bool, [UNTRACKED],
- "print some statistics about the query system (default: no)"),
- hir_stats: bool = (false, parse_bool, [UNTRACKED],
+ dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED],
+ "in addition to `.mir` files, create graphviz `.dot` files (default: no)"),
+ embed_bitcode: bool = (false, parse_bool, [TRACKED],
+ "embed LLVM bitcode in object files (default: no)"),
+ emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
+ "emit a section containing stack size metadata (default: no)"),
+ fewer_names: bool = (false, parse_bool, [TRACKED],
+ "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
+ (default: no)"),
+ force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "force overflow checks on or off"),
+ force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
+ "force all crates to be `rustc_private` unstable (default: no)"),
+ fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
+ "set the optimization fuel quota for a crate"),
+ hir_stats: bool = (false, parse_bool, [UNTRACKED],
"print some statistics about AST and HIR (default: no)"),
- always_encode_mir: bool = (false, parse_bool, [TRACKED],
- "encode MIR of all functions into the crate metadata (default: no)"),
- unleash_the_miri_inside_of_you: bool = (false, parse_bool, [TRACKED],
- "take the brakes off const evaluation. NOTE: this is unsound (default: no)"),
+ human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
+ "generate human-readable, predictable names for codegen units (default: no)"),
+ identify_regions: bool = (false, parse_bool, [UNTRACKED],
+ "display unnamed regions as `'<id>`, using a non-ident unique id (default: no)"),
+ incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED],
+ "ignore spans during ICH computation -- used for testing (default: no)"),
+ incremental_info: bool = (false, parse_bool, [UNTRACKED],
+ "print high-level information about incremental reuse (or the lack thereof) \
+ (default: no)"),
+ incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED],
+ "verify incr. comp. hashes of green query instances (default: no)"),
+ inline_in_all_cgus: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "control whether `#[inline]` functions are in all CGUs"),
+ input_stats: bool = (false, parse_bool, [UNTRACKED],
+ "gather statistics about the input (default: no)"),
+ insert_sideeffect: bool = (false, parse_bool, [TRACKED],
+ "fix undefined behavior when a thread doesn't eventually make progress \
+ (such as entering an empty infinite loop) by inserting llvm.sideeffect \
+ (default: no)"),
+ instrument_mcount: bool = (false, parse_bool, [TRACKED],
+ "insert function instrument code for mcount-based tracing (default: no)"),
+ keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
+ "keep hygiene data after analysis (default: no)"),
+ link_native_libraries: bool = (true, parse_bool, [UNTRACKED],
+ "link native libraries in the linker invocation (default: yes)"),
+ link_only: bool = (false, parse_bool, [TRACKED],
+ "link the `.rlink` file generated by `-Z no-link` (default: no)"),
+ llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],
+ "generate JSON tracing data file from LLVM data (default: no)"),
+ ls: bool = (false, parse_bool, [UNTRACKED],
+ "list the symbols defined by a library crate (default: no)"),
+ macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
+ "show macro backtraces (default: no)"),
+ merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED],
+ "control the operation of the MergeFunctions LLVM pass, taking \
+ the same values as the target option of the same name"),
+ meta_stats: bool = (false, parse_bool, [UNTRACKED],
+ "gather metadata statistics (default: no)"),
+ mir_emit_retag: bool = (false, parse_bool, [TRACKED],
+ "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \
+ (default: no)"),
+ mir_opt_level: usize = (1, parse_uint, [TRACKED],
+ "MIR optimization level (0-3; default: 1)"),
+ mutable_noalias: bool = (false, parse_bool, [TRACKED],
+ "emit noalias metadata for mutable references (default: no)"),
+ new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],
+ "use new LLVM pass manager (default: no)"),
+ nll_facts: bool = (false, parse_bool, [UNTRACKED],
+ "dump facts from NLL analysis into side files (default: no)"),
+ no_analysis: bool = (false, parse_no_flag, [UNTRACKED],
+ "parse and expand the source, but run no analysis"),
+ no_codegen: bool = (false, parse_no_flag, [TRACKED],
+ "run all passes except codegen; no output"),
+ no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
+ "omit DWARF address ranges that give faster lookups"),
+ no_interleave_lints: bool = (false, parse_no_flag, [UNTRACKED],
+ "execute lints separately; allows benchmarking individual lints"),
+ no_landing_pads: bool = (false, parse_no_flag, [TRACKED],
+ "omit landing pads for unwinding"),
+ no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
+ "disable the 'leak check' for subtyping; unsound, but useful for tests"),
+ no_link: bool = (false, parse_no_flag, [TRACKED],
+ "compile without linking"),
+ no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED],
+ "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
+ no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
+ "prevent automatic injection of the profiler_builtins crate"),
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
- sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
- "use a sanitizer"),
- sanitizer_recover: Vec<Sanitizer> = (vec![], parse_sanitizer_list, [TRACKED],
- "enable recovery for selected sanitizers"),
- sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED],
- "enable origins tracking in MemorySanitizer"),
- 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"),
- force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
- "force all crates to be `rustc_private` unstable (default: no)"),
+ panic_abort_tests: bool = (false, parse_bool, [TRACKED],
+ "support compiling tests with panic=abort (default: no)"),
+ parse_only: bool = (false, parse_bool, [UNTRACKED],
+ "parse only; do not compile, assemble, or link (default: no)"),
+ perf_stats: bool = (false, parse_bool, [UNTRACKED],
+ "print some performance-related statistics (default: no)"),
+ plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "whether to use the PLT when calling into shared libraries;
+ only has effect for PIC code on systems with ELF binaries
+ (default: PLT is disabled if full relro is enabled)"),
+ polonius: bool = (false, parse_bool, [UNTRACKED],
+ "enable polonius-based borrow-checker (default: no)"),
pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED],
"a single extra argument to prepend the linker invocation (can be used several times)"),
pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
"extra arguments to prepend to the linker invocation (space separated)"),
+ print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
+ "make rustc print the total optimization fuel used by a crate"),
+ print_link_args: bool = (false, parse_bool, [UNTRACKED],
+ "print the arguments passed to the linker (default: no)"),
+ print_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
+ "print the LLVM optimization passes being run (default: no)"),
+ print_mono_items: Option<String> = (None, parse_opt_string, [UNTRACKED],
+ "print the result of the monomorphization collection pass"),
+ print_region_graph: bool = (false, parse_bool, [UNTRACKED],
+ "prints region inference graph. \
+ Use with RUST_REGION_GRAPH=help for more info (default: no)"),
+ print_type_sizes: bool = (false, parse_bool, [UNTRACKED],
+ "print layout information for each type encountered (default: no)"),
profile: bool = (false, parse_bool, [TRACKED],
"insert profiling code (default: no)"),
- no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
- "prevent automatic injection of the profiler_builtins crate"),
+ query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
+ "enable queries of the dependency graph for regression testing (default: no)"),
+ query_stats: bool = (false, parse_bool, [UNTRACKED],
+ "print some statistics about the query system (default: no)"),
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
"choose which RELRO level to use"),
- nll_facts: bool = (false, parse_bool, [UNTRACKED],
- "dump facts from NLL analysis into side files (default: no)"),
- dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED],
- "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting) \
- (default: no)"),
- polonius: bool = (false, parse_bool, [UNTRACKED],
- "enable polonius-based borrow-checker (default: no)"),
- 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 (default: no)"),
- human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],
- "generate human-readable, predictable names for codegen units (default: no)"),
- dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
- "in dep-info output, omit targets for tracking dependencies of the dep-info files \
- themselves (default: no)"),
- unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
- "present the input source, unstable (and less-pretty) variants;
- valid types are any of the types for `--pretty`, as well as:
- `expanded`, `expanded,identified`,
- `expanded,hygiene` (with internal representations),
- `everybody_loops` (all function bodies replaced with `loop {}`),
- `hir` (the HIR), `hir,identified`,
- `hir,typed` (HIR with types for each node),
- `hir-tree` (dump the raw HIR),
- `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"),
+ report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
+ "immediately print bugs registered with `delay_span_bug` (default: no)"),
// The default historical behavior was to always run dsymutil, so we're
// preserving that temporarily, but we're likely to switch the default
// soon.
run_dsymutil: bool = (true, parse_bool, [TRACKED],
"if on Mac, run `dsymutil` and delete intermediate object files (default: yes)"),
- ui_testing: bool = (false, parse_bool, [UNTRACKED],
- "emit compiler diagnostics in a form suitable for UI testing (default: no)"),
- embed_bitcode: bool = (false, parse_bool, [TRACKED],
- "embed LLVM bitcode in object files (default: no)"),
- strip_debuginfo_if_disabled: bool = (false, parse_bool, [TRACKED],
- "tell the linker to strip debuginfo when building without debuginfo enabled \
- (default: no)"),
- share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED],
- "make the current crate share its generic instantiations"),
- no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED],
- "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
- no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
- "disable the 'leak check' for subtyping; unsound, but useful for tests"),
- no_interleave_lints: bool = (false, parse_no_flag, [UNTRACKED],
- "execute lints separately; allows benchmarking individual lints"),
- crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
- "inject the given attribute in the crate"),
+ sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
+ "use a sanitizer"),
+ sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED],
+ "enable origins tracking in MemorySanitizer"),
+ sanitizer_recover: Vec<Sanitizer> = (vec![], parse_sanitizer_list, [TRACKED],
+ "enable recovery for selected sanitizers"),
+ 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 (default: no)"),
+ save_analysis: bool = (false, parse_bool, [UNTRACKED],
+ "write syntax and type analysis (in JSON format) information, in \
+ addition to normal output (default: no)"),
self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled,
parse_switch_with_opt_path, [UNTRACKED],
"run the self profiler and output the raw event data"),
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, query-keys, function-args, args, llvm"),
- emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
- "emit a section containing stack size metadata (default: no)"),
- plt: Option<bool> = (None, parse_opt_bool, [TRACKED],
- "whether to use the PLT when calling into shared libraries;
- only has effect for PIC code on systems with ELF binaries
- (default: PLT is disabled if full relro is enabled)"),
- merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED],
- "control the operation of the MergeFunctions LLVM pass, taking \
- the same values as the target option of the same name"),
- allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED],
- "only allow the listed language features to be enabled in code (space separated)"),
+ share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "make the current crate share its generic instantiations"),
+ show_span: Option<String> = (None, parse_opt_string, [TRACKED],
+ "show spans for compiler debugging (expr|pat|ty)"),
+ // o/w tests have closure@path
+ span_free_formats: bool = (false, parse_bool, [UNTRACKED],
+ "exclude spans when debug-printing compiler state (default: no)"),
+ src_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_src_file_hash, [TRACKED],
+ "hash algorithm of source files in debug info (`md5`, or `sha1`)"),
+ strip_debuginfo_if_disabled: bool = (false, parse_bool, [TRACKED],
+ "tell the linker to strip debuginfo when building without debuginfo enabled \
+ (default: no)"),
symbol_mangling_version: SymbolManglingVersion = (SymbolManglingVersion::Legacy,
parse_symbol_mangling_version, [TRACKED],
"which mangling version to use for symbol names"),
- binary_dep_depinfo: bool = (false, parse_bool, [TRACKED],
- "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \
- (default: no)"),
- insert_sideeffect: bool = (false, parse_bool, [TRACKED],
- "fix undefined behavior when a thread doesn't eventually make progress \
- (such as entering an empty infinite loop) by inserting llvm.sideeffect \
- (default: no)"),
- deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED],
- "deduplicate identical diagnostics (default: yes)"),
- control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [UNTRACKED],
- "use Windows Control Flow Guard (`disabled`, `nochecks` or `checks`)"),
- no_link: bool = (false, parse_no_flag, [TRACKED],
- "compile without linking"),
- link_only: bool = (false, parse_bool, [TRACKED],
- "link the `.rlink` file generated by `-Z no-link` (default: no)"),
- new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],
- "use new LLVM pass manager (default: no)"),
- link_native_libraries: bool = (true, parse_bool, [UNTRACKED],
- "link native libraries in the linker invocation (default: yes)"),
- src_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_src_file_hash, [TRACKED],
- "hash algorithm of source files in debug info (`md5`, or `sha1`)"),
+ teach: bool = (false, parse_bool, [TRACKED],
+ "show extended diagnostic help (default: no)"),
+ terminal_width: Option<usize> = (None, parse_opt_uint, [UNTRACKED],
+ "set the current terminal width"),
+ thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED],
+ "enable ThinLTO when possible"),
+ // We default to 1 here since we want to behave like
+ // a sequential compiler for now. This'll likely be adjusted
+ // in the future. Note that -Zthreads=0 is the way to get
+ // the num_cpus behavior.
+ threads: usize = (1, parse_threads, [UNTRACKED],
+ "use a thread pool with N threads"),
+ time: bool = (false, parse_bool, [UNTRACKED],
+ "measure time of rustc processes (default: no)"),
+ time_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
+ "measure time of each LLVM pass (default: no)"),
+ time_passes: bool = (false, parse_bool, [UNTRACKED],
+ "measure time of each rustc pass (default: no)"),
+ tls_model: Option<String> = (None, parse_opt_string, [TRACKED],
+ "choose the TLS model to use (`rustc --print tls-models` for details)"),
+ trace_macros: bool = (false, parse_bool, [UNTRACKED],
+ "for every macro invocation, print its name and arguments (default: no)"),
+ treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED],
+ "treat error number `val` that occurs as bug"),
+ ui_testing: bool = (false, parse_bool, [UNTRACKED],
+ "emit compiler diagnostics in a form suitable for UI testing (default: no)"),
+ unleash_the_miri_inside_of_you: bool = (false, parse_bool, [TRACKED],
+ "take the brakes off const evaluation. NOTE: this is unsound (default: no)"),
+ unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
+ "present the input source, unstable (and less-pretty) variants;
+ valid types are any of the types for `--pretty`, as well as:
+ `expanded`, `expanded,identified`,
+ `expanded,hygiene` (with internal representations),
+ `everybody_loops` (all function bodies replaced with `loop {}`),
+ `hir` (the HIR), `hir,identified`,
+ `hir,typed` (HIR with types for each node),
+ `hir-tree` (dump the raw HIR),
+ `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"),
+ unstable_options: bool = (false, parse_bool, [UNTRACKED],
+ "adds unstable command line options to rustc interface (default: no)"),
+ verbose: bool = (false, parse_bool, [UNTRACKED],
+ "in general, enable more debug printouts (default: no)"),
+ verify_llvm_ir: bool = (false, parse_bool, [TRACKED],
+ "verify LLVM IR (default: no)"),
+
+ // This list is in alphabetical order.
+ //
+ // If you add a new option, please update:
+ // - src/librustc_interface/tests.rs
}