From 43101b6b393baa044d7fc3d7881baae9c6b47456 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Fri, 18 May 2018 14:56:41 +0200 Subject: [PATCH] experimental: share generic code for optimized builds. --- src/bootstrap/bin/rustc.rs | 3 +++ src/librustc/ty/context.rs | 14 ++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 4607ca5cf9f48..9115d849cab5c 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -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: {:?}={:?} {:?}", diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ee55b8dd7672f..f69594e81798a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -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}; @@ -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, } }