File tree Expand file tree Collapse file tree 3 files changed +11
-13
lines changed
Expand file tree Collapse file tree 3 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -127,16 +127,7 @@ impl<'tcx> MonoItem<'tcx> {
127127 return InstantiationMode :: LocalCopy ;
128128 }
129129
130- // Finally, if this is `#[inline(always)]` we're sure to respect
131- // that with an inline copy per CGU, but otherwise we'll be
132- // creating one copy of this `#[inline]` function which may
133- // conflict with upstream crates as it could be an exported
134- // symbol.
135- if tcx. codegen_fn_attrs ( instance. def_id ( ) ) . inline . always ( ) {
136- InstantiationMode :: LocalCopy
137- } else {
138- InstantiationMode :: GloballyShared { may_conflict : true }
139- }
130+ InstantiationMode :: GloballyShared { may_conflict : true }
140131 }
141132 MonoItem :: Static ( ..) | MonoItem :: GlobalAsm ( ..) => {
142133 InstantiationMode :: GloballyShared { may_conflict : false }
Original file line number Diff line number Diff line change @@ -690,6 +690,14 @@ fn compute_codegen_unit_name(
690690 let mut cgu_def_id = None ;
691691 // Walk backwards from the item we want to find the module for.
692692 loop {
693+ if tcx. sess . opts . incremental . is_some ( )
694+ && tcx. sess . opts . optimize == rustc_session:: config:: OptLevel :: No
695+ && def_id. is_local ( )
696+ {
697+ cgu_def_id = Some ( current_def_id) ;
698+ break ;
699+ }
700+
693701 if current_def_id. is_crate_root ( ) {
694702 if cgu_def_id. is_none ( ) {
695703 // If we have not found a module yet, take the crate root.
@@ -716,8 +724,7 @@ fn compute_codegen_unit_name(
716724 let def_path = tcx. def_path ( cgu_def_id) ;
717725
718726 let components = def_path. data . iter ( ) . map ( |part| match part. data . name ( ) {
719- DefPathDataName :: Named ( name) => name,
720- DefPathDataName :: Anon { .. } => unreachable ! ( ) ,
727+ DefPathDataName :: Named ( name) | DefPathDataName :: Anon { namespace : name } => name,
721728 } ) ;
722729
723730 let volatile_suffix = volatile. then_some ( "volatile" ) ;
Original file line number Diff line number Diff line change @@ -788,7 +788,7 @@ impl Session {
788788 // codegen units in order to reduce the "collateral damage" small
789789 // changes cause.
790790 if self . opts . incremental . is_some ( ) {
791- return CodegenUnits :: Default ( 256 ) ;
791+ return CodegenUnits :: Default ( 4096 ) ;
792792 }
793793
794794 // Why is 16 codegen units the default all the time?
You can’t perform that action at this time.
0 commit comments