Skip to content

Commit

Permalink
Truncate hex stable crate id to 8 characters (32 bits)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jul 6, 2021
1 parent ca935dd commit 56c6a48
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions compiler/rustc_middle/src/mir/mono.rs
Expand Up @@ -494,14 +494,19 @@ impl CodegenUnitNameBuilder<'tcx> {
format!(
"-in-{}.{:08x}",
tcx.crate_name(LOCAL_CRATE),
local_stable_crate_id.to_u64()
local_stable_crate_id.to_u64() as u32,
)
} else {
String::new()
};

let stable_crate_id = tcx.sess.local_stable_crate_id();
format!("{}.{:08x}{}", tcx.crate_name(cnum), stable_crate_id.to_u64(), local_crate_id)
format!(
"{}.{:08x}{}",
tcx.crate_name(cnum),
stable_crate_id.to_u64() as u32,
local_crate_id,
)
});

write!(cgu_name, "{}", crate_prefix).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lto-duplicate-symbols.stderr
@@ -1,6 +1,6 @@
warning: Linking globals named 'foo': symbol multiply defined!

error: failed to load bc of "lto-duplicate-symbols2.lto_duplicate_symbols2.288b404e693a75b4-cgu.0.rcgu.o":
error: failed to load bc of "lto-duplicate-symbols2.lto_duplicate_symbols2.693a75b4-cgu.0.rcgu.o":

error: aborting due to previous error; 1 warning emitted

0 comments on commit 56c6a48

Please sign in to comment.