!self.debugging_opts.parse_only && // The file is just being parsed
!self.debugging_opts.ls // The file is just being queried
}
+
+ #[inline]
+ pub fn share_generics(&self) -> bool {
+ match self.debugging_opts.share_generics {
+ Some(setting) => setting,
+ None => {
+ self.incremental.is_some() ||
+ match self.optimize {
+ OptLevel::No |
+ OptLevel::Less |
+ OptLevel::Size |
+ OptLevel::SizeMin => true,
+ OptLevel::Default |
+ OptLevel::Aggressive => false,
+ }
+ }
+ }
+ }
}
// The type of entry function, so
use dep_graph::{DepNode, DepConstructor};
use errors::DiagnosticBuilder;
use session::Session;
-use session::config::{BorrowckMode, OutputFilenames, OptLevel};
+use session::config::{BorrowckMode, OutputFilenames};
use session::config::CrateType;
use middle;
use hir::{TraitCandidate, HirId, ItemLocalId};
self.use_mir_borrowck()
}
- #[inline]
- pub fn share_generics(self) -> bool {
- match self.sess.opts.debugging_opts.share_generics {
- Some(setting) => setting,
- None => {
- self.sess.opts.incremental.is_some() ||
- match self.sess.opts.optimize {
- OptLevel::No |
- OptLevel::Less |
- OptLevel::Size |
- OptLevel::SizeMin => true,
- OptLevel::Default |
- OptLevel::Aggressive => false,
- }
- }
- }
- }
-
#[inline]
pub fn local_crate_exports_generics(self) -> bool {
- debug_assert!(self.share_generics());
+ debug_assert!(self.sess.opts.share_generics());
self.sess.crate_types.borrow().iter().any(|crate_type| {
match crate_type {
symbols.push((exported_symbol, SymbolExportLevel::Rust));
}
- if tcx.share_generics() && tcx.local_crate_exports_generics() {
+ if tcx.sess.opts.share_generics() && tcx.local_crate_exports_generics() {
use rustc::mir::mono::{Linkage, Visibility, MonoItem};
use rustc::ty::InstanceDef;
// This is a monomorphization. Its expected visibility depends
// on whether we are in share-generics mode.
- if cx.tcx.share_generics() {
+ if cx.tcx.sess.opts.share_generics() {
// We are in share_generics mode.
if instance_def_id.is_local() {
if avoid_cross_crate_conflicts {
let instantiating_crate = if is_generic {
- if !def_id.is_local() && tcx.share_generics() {
+ if !def_id.is_local() && tcx.sess.opts.share_generics() {
// If we are re-using a monomorphization from another crate,
// we have to compute the symbol hash accordingly.
let upstream_monomorphizations = tcx.upstream_monomorphizations_for(def_id);
// If we are not in share generics mode, we don't link to upstream
// monomorphizations but always instantiate our own internal versions
// instead.
- if !tcx.share_generics() {
+ if !tcx.sess.opts.share_generics() {
return false
}
// available to downstream crates. This depends on whether we are in
// share-generics mode and whether the current crate can even have
// downstream crates.
- let export_generics = tcx.share_generics() &&
+ let export_generics = tcx.sess.opts.share_generics() &&
tcx.local_crate_exports_generics();
for mono_item in mono_items {