Skip to content

Commit

Permalink
experimental: share generic code for optimized builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed May 18, 2018
1 parent 2a421f8 commit 43101b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ fn main() {
cmd.arg("-Dwarnings");
}

// Always disabling sharing of generic code for build compiler artifacts
cmd.arg("-Zshare-generics=off");

if verbose > 1 {
eprintln!(
"rustc command: {:?}={:?} {:?}",
Expand Down
14 changes: 2 additions & 12 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use dep_graph::DepGraph;
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};
Expand Down Expand Up @@ -1511,17 +1511,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
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,
}
}
None => true,
}
}

Expand Down

0 comments on commit 43101b6

Please sign in to comment.