This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -691,6 +691,14 @@ fn compute_codegen_unit_name(
691691 let mut cgu_def_id = None ;
692692 // Walk backwards from the item we want to find the module for.
693693 loop {
694+ if tcx. sess . opts . incremental . is_some ( )
695+ && tcx. sess . opts . optimize == rustc_session:: config:: OptLevel :: No
696+ && def_id. is_local ( )
697+ {
698+ cgu_def_id = Some ( current_def_id) ;
699+ break ;
700+ }
701+
694702 if current_def_id. is_crate_root ( ) {
695703 if cgu_def_id. is_none ( ) {
696704 // If we have not found a module yet, take the crate root.
@@ -717,8 +725,7 @@ fn compute_codegen_unit_name(
717725 let def_path = tcx. def_path ( cgu_def_id) ;
718726
719727 let components = def_path. data . iter ( ) . map ( |part| match part. data . name ( ) {
720- DefPathDataName :: Named ( name) => name,
721- DefPathDataName :: Anon { .. } => unreachable ! ( ) ,
728+ DefPathDataName :: Named ( name) | DefPathDataName :: Anon { namespace : name } => name,
722729 } ) ;
723730
724731 let volatile_suffix = volatile. then_some ( "volatile" ) ;
Original file line number Diff line number Diff line change @@ -830,7 +830,7 @@ impl Session {
830830 // codegen units in order to reduce the "collateral damage" small
831831 // changes cause.
832832 if self . opts . incremental . is_some ( ) {
833- return CodegenUnits :: Default ( 256 ) ;
833+ return CodegenUnits :: Default ( 4096 ) ;
834834 }
835835
836836 // Why is 16 codegen units the default all the time?
You can’t perform that action at this time.
0 commit comments