[][src]Struct rustc_ap_rustc_session::Session

pub struct Session {
    pub target: Config,
    pub host: Target,
    pub opts: Options,
    pub host_tlib_path: SearchPath,
    pub target_tlib_path: Option<SearchPath>,
    pub parse_sess: ParseSess,
    pub sysroot: PathBuf,
    pub local_crate_source_file: Option<PathBuf>,
    pub working_dir: (PathBuf, bool),
    pub one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>,
    pub crate_types: Once<Vec<CrateType>>,
    pub crate_disambiguator: Once<CrateDisambiguator>,
    pub recursion_limit: Once<usize>,
    pub type_length_limit: Once<usize>,
    pub const_eval_limit: Once<usize>,
    pub cgu_reuse_tracker: CguReuseTracker,
    pub prof: SelfProfilerRef,
    pub perf_stats: PerfStats,
    pub code_stats: CodeStats,
    pub print_fuel_crate: Option<String>,
    pub print_fuel: AtomicU64,
    pub jobserver: Client,
    pub driver_lint_caps: FxHashMap<LintId, Level>,
    pub trait_methods_not_found: Lock<FxHashSet<Span>>,
    pub confused_type_with_std_module: Lock<FxHashMap<Span, Span>>,
    pub system_library_path: OneThread<RefCell<Option<Option<PathBuf>>>>,
    pub ctfe_backtrace: Lock<CtfeBacktrace>,
    pub real_rust_source_base_dir: Option<PathBuf>,
    // some fields omitted
}

Represents the data associated with a compilation session for a single crate.

Fields

target: Confighost: Targetopts: Optionshost_tlib_path: SearchPathtarget_tlib_path: Option<SearchPath>

None if the host and target are the same.

parse_sess: ParseSesssysroot: PathBuflocal_crate_source_file: Option<PathBuf>

The name of the root source file of the crate, in the local file system. None means that there is no source file.

working_dir: (PathBuf, bool)

The directory the compiler has been executed in plus a flag indicating if the value stored here has been affected by path remapping.

one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>

Set of (DiagnosticId, Option<Span>, message) tuples tracking (sub)diagnostics that have been set once, but should not be set again, in order to avoid redundantly verbose output (Issue #24690, #44953).

crate_types: Once<Vec<CrateType>>crate_disambiguator: Once<CrateDisambiguator>

The crate_disambiguator is constructed out of all the -C metadata arguments passed to the compiler. Its value together with the crate-name forms a unique global identifier for the crate. It is used to allow multiple crates with the same name to coexist. See the rustc_codegen_llvm::back::symbol_names module for more information.

recursion_limit: Once<usize>

The maximum recursion limit for potentially infinitely recursive operations such as auto-dereference and monomorphization.

type_length_limit: Once<usize>

The maximum length of types during monomorphization.

const_eval_limit: Once<usize>

The maximum blocks a const expression can evaluate.

cgu_reuse_tracker: CguReuseTracker

Used for incremental compilation tests. Will only be populated if -Zquery-dep-graph is specified.

prof: SelfProfilerRef

Used by -Z self-profile.

perf_stats: PerfStats

Some measurements that are being gathered during compilation.

code_stats: CodeStats

Data about code being compiled, gathered during compilation.

print_fuel_crate: Option<String>

If -zprint-fuel=crate, Some(crate).

print_fuel: AtomicU64

Always set to zero and incremented so that we can print fuel expended by a crate.

jobserver: Client

Loaded up early on in the initialization of this Session to avoid false positives about a job server in our environment.

driver_lint_caps: FxHashMap<LintId, Level>

Cap lint level specified by a driver specifically.

trait_methods_not_found: Lock<FxHashSet<Span>>

Spans of trait methods that weren't found to avoid emitting object safety errors

confused_type_with_std_module: Lock<FxHashMap<Span, Span>>

Mapping from ident span to path span for paths that don't exist as written, but that exist under std. For example, wrote str::from_utf8 instead of std::str::from_utf8.

system_library_path: OneThread<RefCell<Option<Option<PathBuf>>>>

Path for libraries that will take preference over libraries shipped by Rust. Used by windows-gnu targets to priortize system mingw-w64 libraries.

ctfe_backtrace: Lock<CtfeBacktrace>

Tracks the current behavior of the CTFE engine when an error occurs. Options range from returning the error without a backtrace to returning an error and immediately printing the backtrace to stderr.

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).

Methods

impl Session[src]

pub fn timer<'a>(&'a self, what: &'static str) -> VerboseTimingGuard<'a>[src]

pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R[src]

impl Session[src]

pub fn local_crate_disambiguator(&self) -> CrateDisambiguator[src]

pub fn struct_span_warn<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str
) -> DiagnosticBuilder
[src]

pub fn struct_span_warn_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder
[src]

pub fn struct_warn(&self, msg: &str) -> DiagnosticBuilder[src]

pub fn struct_span_err<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str
) -> DiagnosticBuilder
[src]

pub fn struct_span_err_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder
[src]

pub fn struct_err(&self, msg: &str) -> DiagnosticBuilder[src]

pub fn struct_err_with_code(
    &self,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder
[src]

pub fn struct_span_fatal<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str
) -> DiagnosticBuilder
[src]

pub fn struct_span_fatal_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
) -> DiagnosticBuilder
[src]

pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder[src]

pub fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ![src]

pub fn span_fatal_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
) -> !
[src]

pub fn fatal(&self, msg: &str) -> ![src]

pub fn span_err_or_warn<S: Into<MultiSpan>>(
    &self,
    is_warning: bool,
    sp: S,
    msg: &str
)
[src]

pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: &str)[src]

pub fn span_err_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
)
[src]

pub fn err(&self, msg: &str)[src]

pub fn err_count(&self) -> usize[src]

pub fn has_errors(&self) -> bool[src]

pub fn has_errors_or_delayed_span_bugs(&self) -> bool[src]

pub fn abort_if_errors(&self)[src]

pub fn compile_status(&self) -> Result<(), ErrorReported>[src]

pub fn track_errors<F, T>(&self, f: F) -> Result<T, ErrorReported> where
    F: FnOnce() -> T, 
[src]

pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: &str)[src]

pub fn span_warn_with_code<S: Into<MultiSpan>>(
    &self,
    sp: S,
    msg: &str,
    code: DiagnosticId
)
[src]

pub fn warn(&self, msg: &str)[src]

pub fn opt_span_warn<S: Into<MultiSpan>>(&self, opt_sp: Option<S>, msg: &str)[src]

pub fn delay_span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: &str)[src]

Delay a span_bug() call until abort_if_errors()

pub fn note_without_error(&self, msg: &str)[src]

pub fn span_note_without_error<S: Into<MultiSpan>>(&self, sp: S, msg: &str)[src]

pub fn diagnostic(&self) -> &Handler[src]

pub fn diag_span_note_once<'a, 'b>(
    &'a self,
    diag_builder: &'b mut DiagnosticBuilder<'a>,
    msg_id: DiagnosticMessageId,
    span: Span,
    message: &str
)
[src]

pub fn diag_note_once<'a, 'b>(
    &'a self,
    diag_builder: &'b mut DiagnosticBuilder<'a>,
    msg_id: DiagnosticMessageId,
    message: &str
)
[src]

pub fn diag_span_suggestion_once<'a, 'b>(
    &'a self,
    diag_builder: &'b mut DiagnosticBuilder<'a>,
    msg_id: DiagnosticMessageId,
    span: Span,
    message: &str,
    suggestion: String
)
[src]

pub fn source_map(&self) -> &SourceMap[src]

pub fn verbose(&self) -> bool[src]

pub fn time_passes(&self) -> bool[src]

pub fn instrument_mcount(&self) -> bool[src]

pub fn time_llvm_passes(&self) -> bool[src]

pub fn meta_stats(&self) -> bool[src]

pub fn asm_comments(&self) -> bool[src]

pub fn verify_llvm_ir(&self) -> bool[src]

pub fn borrowck_stats(&self) -> bool[src]

pub fn print_llvm_passes(&self) -> bool[src]

pub fn binary_dep_depinfo(&self) -> bool[src]

pub fn features_untracked(&self) -> &Features[src]

Gets the features enabled for the current compilation session. DO NOT USE THIS METHOD if there is a TyCtxt available, as it circumvents dependency tracking. Use tcx.features() instead.

pub fn init_features(&self, features: Features)[src]

pub fn lto(&self) -> Lto[src]

Calculates the flavor of LTO to use for this compilation.

pub fn panic_strategy(&self) -> PanicStrategy[src]

Returns the panic strategy for this compile session. If the user explicitly selected one using '-C panic', use that, otherwise use the panic strategy defined by the target.

pub fn fewer_names(&self) -> bool[src]

pub fn no_landing_pads(&self) -> bool[src]

pub fn unstable_options(&self) -> bool[src]

pub fn overflow_checks(&self) -> bool[src]

pub fn crt_static(&self, crate_type: Option<CrateType>) -> bool[src]

Check whether this compile session and crate type use static crt.

pub fn crt_static_feature(&self, crate_type: Option<CrateType>) -> bool[src]

Check whether this compile session and crate type use crt-static feature.

pub fn must_not_eliminate_frame_pointers(&self) -> bool[src]

pub fn generate_plugin_registrar_symbol(
    &self,
    disambiguator: CrateDisambiguator
) -> String
[src]

Returns the symbol name for the registrar function, given the crate Svh and the function DefIndex.

pub fn generate_proc_macro_decls_symbol(
    &self,
    disambiguator: CrateDisambiguator
) -> String
[src]

pub fn target_filesearch(&self, kind: PathKind) -> FileSearch[src]

pub fn host_filesearch(&self, kind: PathKind) -> FileSearch[src]

pub fn set_incr_session_load_dep_graph(&self, load: bool)[src]

pub fn incr_session_load_dep_graph(&self) -> bool[src]

pub fn init_incr_comp_session(
    &self,
    session_dir: PathBuf,
    lock_file: Lock,
    load_dep_graph: bool
)
[src]

pub fn finalize_incr_comp_session(&self, new_directory_path: PathBuf)[src]

pub fn mark_incr_comp_session_as_invalid(&self)[src]

pub fn incr_comp_session_dir(&self) -> Ref<PathBuf>[src]

pub fn incr_comp_session_dir_opt(&self) -> Option<Ref<PathBuf>>[src]

pub fn print_perf_stats(&self)[src]

pub fn consider_optimizing<T: Fn() -> String>(
    &self,
    crate_name: &str,
    msg: T
) -> bool
[src]

We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n. This expends fuel if applicable, and records fuel if applicable.

pub fn threads(&self) -> usize[src]

Returns the number of query threads that should be used for this compilation

pub fn codegen_units(&self) -> usize[src]

Returns the number of codegen units that should be used for this compilation

pub fn teach(&self, code: &DiagnosticId) -> bool[src]

pub fn rust_2015(&self) -> bool[src]

pub fn rust_2018(&self) -> bool[src]

Are we allowed to use features from the Rust 2018 edition?

pub fn edition(&self) -> Edition[src]

pub fn needs_plt(&self) -> bool[src]

Returns true if we cannot skip the PLT for shared library calls.

Auto Trait Implementations

impl !RefUnwindSafe for Session

impl !Send for Session

impl !Sync for Session

impl Unpin for Session

impl !UnwindSafe for Session

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<E> SpecializationError for E[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.