File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed
Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -118,15 +118,7 @@ impl<'tcx> MonoItem<'tcx> {
118118 return InstantiationMode :: LocalCopy ;
119119 }
120120
121- // Finally, if this is `#[inline(always)]` we're sure to respect
122- // that with an inline copy per CGU, but otherwise we'll be
123- // creating one copy of this `#[inline]` function which may
124- // conflict with upstream crates as it could be an exported
125- // symbol.
126- match tcx. codegen_fn_attrs ( instance. def_id ( ) ) . inline {
127- InlineAttr :: Always => InstantiationMode :: LocalCopy ,
128- _ => InstantiationMode :: GloballyShared { may_conflict : true } ,
129- }
121+ InstantiationMode :: GloballyShared { may_conflict : true }
130122 }
131123 MonoItem :: Static ( ..) | MonoItem :: GlobalAsm ( ..) => {
132124 InstantiationMode :: GloballyShared { may_conflict : false }
Original file line number Diff line number Diff line change @@ -694,6 +694,14 @@ fn compute_codegen_unit_name(
694694 let mut cgu_def_id = None ;
695695 // Walk backwards from the item we want to find the module for.
696696 loop {
697+ if tcx. sess . opts . incremental . is_some ( )
698+ && tcx. sess . opts . optimize == rustc_session:: config:: OptLevel :: No
699+ && def_id. is_local ( )
700+ {
701+ cgu_def_id = Some ( current_def_id) ;
702+ break ;
703+ }
704+
697705 if current_def_id. is_crate_root ( ) {
698706 if cgu_def_id. is_none ( ) {
699707 // If we have not found a module yet, take the crate root.
@@ -720,8 +728,7 @@ fn compute_codegen_unit_name(
720728 let def_path = tcx. def_path ( cgu_def_id) ;
721729
722730 let components = def_path. data . iter ( ) . map ( |part| match part. data . name ( ) {
723- DefPathDataName :: Named ( name) => name,
724- DefPathDataName :: Anon { .. } => unreachable ! ( ) ,
731+ DefPathDataName :: Named ( name) | DefPathDataName :: Anon { namespace : name } => name,
725732 } ) ;
726733
727734 let volatile_suffix = volatile. then_some ( "volatile" ) ;
Original file line number Diff line number Diff line change @@ -841,7 +841,7 @@ impl Session {
841841 // codegen units in order to reduce the "collateral damage" small
842842 // changes cause.
843843 if self . opts . incremental . is_some ( ) {
844- return CodegenUnits :: Default ( 256 ) ;
844+ return CodegenUnits :: Default ( 4096 ) ;
845845 }
846846
847847 // Why is 16 codegen units the default all the time?
You can’t perform that action at this time.
0 commit comments