Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f5425e2

Browse files
committed
Change partitioning for unoptimized incr builds
1 parent 22da90c commit f5425e2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_monomorphize/src/partitioning.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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");

0 commit comments

Comments
 (0)