pub use self::code_stats::{DataTypeKind, SizeKind, FieldInfo, VariantInfo};
use self::code_stats::CodeStats;
-use dep_graph::cgu_reuse_tracker::CguReuseTracker;
-use hir::def_id::CrateNum;
+use crate::dep_graph::cgu_reuse_tracker::CguReuseTracker;
+use crate::hir::def_id::CrateNum;
use rustc_data_structures::fingerprint::Fingerprint;
-use lint;
-use lint::builtin::BuiltinLintDiagnostics;
-use middle::allocator::AllocatorKind;
-use middle::dependency_format;
-use session::config::{OutputType, Lto};
-use session::search_paths::{PathKind, SearchPath};
-use util::nodemap::{FxHashMap, FxHashSet};
-use util::common::{duration_to_secs_str, ErrorReported};
-use util::common::ProfileQueriesMsg;
+use crate::lint;
+use crate::lint::builtin::BuiltinLintDiagnostics;
+use crate::middle::allocator::AllocatorKind;
+use crate::middle::dependency_format;
+use crate::session::config::{OutputType, Lto};
+use crate::session::search_paths::{PathKind, SearchPath};
+use crate::util::nodemap::{FxHashMap, FxHashSet};
+use crate::util::common::{duration_to_secs_str, ErrorReported};
+use crate::util::common::ProfileQueriesMsg;
use rustc_data_structures::base_n;
use rustc_data_structures::sync::{
Ordering::SeqCst,
};
-use errors::{self, DiagnosticBuilder, DiagnosticId, Applicability};
+use errors::{DiagnosticBuilder, DiagnosticId, Applicability};
use errors::emitter::{Emitter, EmitterWriter};
use syntax::ast::{self, NodeId};
use syntax::edition::Edition;
use syntax::source_map;
use syntax::parse::{self, ParseSess};
use syntax_pos::{MultiSpan, Span};
-use util::profiling::SelfProfiler;
+use crate::util::profiling::SelfProfiler;
use rustc_target::spec::{PanicStrategy, RelroLevel, Target, TargetTriple};
use rustc_data_structures::flock;
pub mod search_paths;
pub struct OptimizationFuel {
- /// If -zfuel=crate=n is specified, initially set to n. Otherwise 0.
+ /// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`.
remaining: u64,
/// We're rejecting all further optimizations.
out_of_fuel: bool,
pub host: Target,
pub opts: config::Options,
pub host_tlib_path: SearchPath,
- /// This is `None` if the host and target are the same.
+ /// `None` if the host and target are the same.
pub target_tlib_path: Option<SearchPath>,
pub parse_sess: ParseSess,
pub sysroot: PathBuf,
/// in order to avoid redundantly verbose output (Issue #24690, #44953).
pub one_time_diagnostics: Lock<FxHashSet<(DiagnosticMessageId, Option<Span>, String)>>,
pub plugin_llvm_passes: OneThread<RefCell<Vec<String>>>,
- pub plugin_attributes: OneThread<RefCell<Vec<(String, AttributeType)>>>,
+ pub plugin_attributes: Lock<Vec<(String, AttributeType)>>,
pub crate_types: Once<Vec<config::CrateType>>,
pub dependency_formats: Once<dependency_format::Dependencies>,
/// The crate_disambiguator is constructed out of all the `-C metadata`
/// The maximum length of types during monomorphization.
pub type_length_limit: Once<usize>,
- /// The maximum number of stackframes allowed in const eval
+ /// The maximum number of stackframes allowed in const eval.
pub const_eval_stack_frame_limit: usize,
/// The metadata::creader module may inject an allocator/panic_runtime
/// `-Zquery-dep-graph` is specified.
pub cgu_reuse_tracker: CguReuseTracker,
- /// Used by -Z profile-queries in util::common
+ /// Used by `-Z profile-queries` in `util::common`.
pub profile_channel: Lock<Option<mpsc::Sender<ProfileQueriesMsg>>>,
- /// Used by -Z self-profile
+ /// Used by `-Z self-profile`.
pub self_profiling_active: bool,
- /// Used by -Z self-profile
+ /// Used by `-Z self-profile`.
pub self_profiling: Lock<SelfProfiler>,
/// Some measurements that are being gathered during compilation.
next_node_id: OneThread<Cell<ast::NodeId>>,
- /// If -zfuel=crate=n is specified, Some(crate).
+ /// If `-zfuel=crate=n` is specified, `Some(crate)`.
optimization_fuel_crate: Option<String>,
- /// Tracks fuel info if If -zfuel=crate=n is specified
+ /// Tracks fuel info if `-zfuel=crate=n` is specified.
optimization_fuel: Lock<OptimizationFuel>,
// The next two are public because the driver needs to read them.
- /// If -zprint-fuel=crate, Some(crate).
+ /// If `-zprint-fuel=crate`, `Some(crate)`.
pub print_fuel_crate: Option<String>,
/// Always set to zero and incremented so that we can print fuel expended by a crate.
pub print_fuel: AtomicU64,
/// false positives about a job server in our environment.
pub jobserver: Client,
- /// Metadata about the allocators for the current crate being compiled
+ /// Metadata about the allocators for the current crate being compiled.
pub has_global_allocator: Once<bool>,
- /// Metadata about the panic handlers for the current crate being compiled
+ /// Metadata about the panic handlers for the current crate being compiled.
pub has_panic_handler: Once<bool>,
/// Cap lint level specified by a driver specifically.
}
pub struct PerfStats {
- /// The accumulated time spent on computing symbol hashes
+ /// The accumulated time spent on computing symbol hashes.
pub symbol_hash_time: Lock<Duration>,
- /// The accumulated time spent decoding def path tables from metadata
+ /// The accumulated time spent decoding def path tables from metadata.
pub decode_def_path_tables_time: Lock<Duration>,
/// Total number of values canonicalized queries constructed.
pub queries_canonicalized: AtomicUsize,
self.opts.debugging_opts.print_llvm_passes
}
- /// Get the features enabled for the current compilation session.
+ /// 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.
#[inline]
self.opts.edition
}
- /// True if we cannot skip the PLT for shared library calls.
+ /// Returns `true` if we cannot skip the PLT for shared library calls.
pub fn needs_plt(&self) -> bool {
// Check if the current target usually needs PLT to be enabled.
// The user can use the command line flag to override it.
buffered_lints: Lock::new(Some(Default::default())),
one_time_diagnostics: Default::default(),
plugin_llvm_passes: OneThread::new(RefCell::new(Vec::new())),
- plugin_attributes: OneThread::new(RefCell::new(Vec::new())),
+ plugin_attributes: Lock::new(Vec::new()),
crate_types: Once::new(),
dependency_formats: Once::new(),
crate_disambiguator: Once::new(),
// bitcode during ThinLTO. Therefore we disallow dynamic linking on MSVC
// when compiling for LLD ThinLTO. This way we can validly just not generate
// the `dllimport` attributes and `__imp_` symbols in that case.
- if sess.opts.debugging_opts.cross_lang_lto.enabled() &&
+ if sess.opts.cg.linker_plugin_lto.enabled() &&
sess.opts.cg.prefer_dynamic &&
sess.target.target.options.is_like_msvc {
sess.err("Linker plugin based LTO is not supported together with \