pub struct Options {
Show 35 fields pub crate_types: Vec<CrateType>, pub optimize: OptLevel, pub debug_assertions: bool, pub debuginfo: DebugInfo, pub lint_opts: Vec<(String, Level)>, pub lint_cap: Option<Level>, pub describe_lints: bool, pub output_types: OutputTypes, pub search_paths: Vec<SearchPath>, pub libs: Vec<NativeLib>, pub maybe_sysroot: Option<PathBuf>, pub target_triple: TargetTriple, pub test: bool, pub error_format: ErrorOutputType, pub diagnostic_width: Option<usize>, pub incremental: Option<PathBuf>, pub assert_incr_state: Option<IncrementalStateAssertion>, pub unstable_opts: UnstableOptions, pub prints: Vec<PrintRequest>, pub cg: CodegenOptions, pub externs: Externs, pub crate_name: Option<String>, pub unstable_features: UnstableFeatures, pub actually_rustdoc: bool, pub trimmed_def_paths: TrimmedDefPaths, pub cli_forced_codegen_units: Option<usize>, pub cli_forced_thinlto_off: bool, pub remap_path_prefix: Vec<(PathBuf, PathBuf)>, pub real_rust_source_base_dir: Option<PathBuf>, pub edition: Edition, pub json_artifact_notifications: bool, pub json_unused_externs: JsonUnusedExterns, pub json_future_incompat: bool, pub pretty: Option<PpMode>, pub working_dir: RealFileName,
Expand description

The top-level command-line options struct.

For each option, one has to specify how it behaves with regard to the dependency tracking system of incremental compilation. This is done via the square-bracketed directive after the field type. The options are:

  • [TRACKED] A change in the given field will cause the compiler to completely clear the incremental compilation cache before proceeding.

  • [TRACKED_NO_CRATE_HASH] Same as [TRACKED], but will not affect the crate hash. This is useful for options that only affect the incremental cache.

  • [UNTRACKED] Incremental compilation is not influenced by this option.

  • [SUBSTRUCT] Second-level sub-structs containing more options.

If you add a new option to this struct or one of the sub-structs like CodegenOptions, think about how it influences incremental compilation. If in doubt, specify [TRACKED], which is always “correct” but might lead to unnecessary re-compilation.


crate_types: Vec<CrateType>

The crate config requested for the session, which may be combined with additional crate configurations during the compile process.

optimize: OptLeveldebug_assertions: bool

Include the debug_assertions flag in dependency tracking, since it can influence whether overflow checks are done or not.

debuginfo: DebugInfolint_opts: Vec<(String, Level)>lint_cap: Option<Level>describe_lints: booloutput_types: OutputTypessearch_paths: Vec<SearchPath>libs: Vec<NativeLib>maybe_sysroot: Option<PathBuf>target_triple: TargetTripletest: boolerror_format: ErrorOutputTypediagnostic_width: Option<usize>incremental: Option<PathBuf>

If Some, enable incremental compilation, using the given directory to store intermediate results.

assert_incr_state: Option<IncrementalStateAssertion>unstable_opts: UnstableOptionsprints: Vec<PrintRequest>cg: CodegenOptionsexterns: Externscrate_name: Option<String>unstable_features: UnstableFeatures

Indicates how the compiler should treat unstable features.

actually_rustdoc: bool

Indicates whether this run of the compiler is actually rustdoc. This is currently just a hack and will be removed eventually, so please try to not rely on this too much.

trimmed_def_paths: TrimmedDefPaths

Control path trimming.

cli_forced_codegen_units: Option<usize>

Specifications of codegen units / ThinLTO which are forced as a result of parsing command line options. These are not necessarily what rustc was invoked with, but massaged a bit to agree with commands like --emit llvm-ir which they’re often incompatible with if we otherwise use the defaults of rustc.

cli_forced_thinlto_off: boolremap_path_prefix: Vec<(PathBuf, PathBuf)>

Remap source path prefixes in all output (messages, object files, debug, etc.).

real_rust_source_base_dir: Option<PathBuf>

Base directory containing the src/ for the Rust standard library, and potentially rustc as well, if we can can find it. Right now it’s always $sysroot/lib/rustlib/src/rust (i.e. the rustup rust-src component).

This directory is what the virtual /rustc/$hash is translated back to, if Rust was built with path remapping to /rustc/$hash enabled (the rust.remap-debuginfo option in config.toml).

edition: Editionjson_artifact_notifications: bool

true if we’re emitting JSON blobs about each artifact produced by the compiler.

json_unused_externs: JsonUnusedExterns

true if we’re emitting a JSON blob containing the unused externs

json_future_incompat: bool

true if we’re emitting a JSON job containing a future-incompat report for lints

pretty: Option<PpMode>working_dir: RealFileName

The (potentially remapped) working directory


Returns true if there is a reason to build the dep graph.

Returns true if there will be an output file generated.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.


Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 1976 bytes