diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2018-03-06 11:56:01 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2018-04-06 12:14:08 +0200 |
| commit | 8d95c869747366f384df0776d03e6df79d760584 (patch) | |
| tree | cc41d308a9d927c1270b89de0272282a843070f5 | |
| parent | 4f6d05dc483003e89d17c539eba4fc7a503d6390 (diff) | |
| download | rust-8d95c869747366f384df0776d03e6df79d760584.tar.gz rust-8d95c869747366f384df0776d03e6df79d760584.zip | |
Make generics sharing the default for non-optimized builds.
| -rw-r--r-- | src/librustc/ty/context.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 8a58dad2924..3da653eb7ad 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}; +use session::config::{BorrowckMode, OutputFilenames, OptLevel}; use middle; use hir::{TraitCandidate, HirId, ItemLocalId}; use hir::def::{Def, Export}; @@ -1503,8 +1503,18 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { #[inline] pub fn share_generics(self) -> bool { match self.sess.opts.debugging_opts.share_generics { - Some(true) => true, - Some(false) | None => false, + 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, + } + } } } } |
