rustc_session::options

Struct Options

Source
pub struct Options {
Show 41 fields pub crate_types: Vec<CrateType>, pub optimize: OptLevel, pub debug_assertions: bool, pub debuginfo: DebugInfo, pub debuginfo_compression: DebugInfoCompression, 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 logical_env: FxIndexMap<String, String>, pub test: bool, pub error_format: ErrorOutputType, pub diagnostic_width: Option<usize>, pub incremental: Option<PathBuf>, pub assert_incr_state: Option<IncrementalStateAssertion>, pub untracked_state_hash: Hash64, 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 resolve_doc_links: ResolveDocLinks, pub trimmed_def_paths: bool, pub cli_forced_codegen_units: Option<usize>, pub cli_forced_local_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, pub color: ColorConfig, pub verbose: bool,
}
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.

Fields§

§crate_types: Vec<CrateType>

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

§optimize: OptLevel§debug_assertions: bool

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

§debuginfo: DebugInfo§debuginfo_compression: DebugInfoCompression§lint_opts: Vec<(String, Level)>§lint_cap: Option<Level>§describe_lints: bool§output_types: OutputTypes§search_paths: Vec<SearchPath>§libs: Vec<NativeLib>§maybe_sysroot: Option<PathBuf>§target_triple: TargetTriple§logical_env: FxIndexMap<String, String>

Effective logical environment used by env!/option_env! macros

§test: bool§error_format: ErrorOutputType§diagnostic_width: Option<usize>§incremental: Option<PathBuf>

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

§assert_incr_state: Option<IncrementalStateAssertion>§untracked_state_hash: Hash64

Set by the Config::hash_untracked_state callback for custom drivers to invalidate the incremental cache

§unstable_opts: UnstableOptions§prints: Vec<PrintRequest>§cg: CodegenOptions§externs: Externs§crate_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.

§resolve_doc_links: ResolveDocLinks

Whether name resolver should resolve documentation links.

§trimmed_def_paths: bool

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_local_thinlto_off: bool§remap_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 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: Edition§json_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

§color: ColorConfig§verbose: bool

Implementations§

Source§

impl Options

Source

pub fn build_dep_graph(&self) -> bool

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

Source

pub fn file_path_mapping(&self) -> FilePathMapping

Source

pub fn will_create_output_file(&self) -> bool

Returns true if there will be an output file generated.

Source

pub fn share_generics(&self) -> bool

Source

pub fn get_symbol_mangling_version(&self) -> SymbolManglingVersion

Source§

impl Options

Source

pub fn dep_tracking_hash(&self, for_crate_hash: bool) -> u64

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a copy of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Options

Source§

fn default() -> Options

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Aligned for T

Source§

const ALIGN: Alignment = _

Alignment of Self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, R> CollectAndApply<T, R> for T

§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<I, T, U> Upcast<I, U> for T
where U: UpcastFrom<I, T>,

§

fn upcast(self, interner: I) -> U

§

impl<I, T> UpcastFrom<I, T> for T

§

fn upcast_from(from: T, _tcx: I) -> T

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,

Layout§

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: 2224 bytes