Skip to content

Commit 333a5cc

Browse files
committed
mangling_v0: Skip extern blocks during mangling
1 parent 1b8daf8 commit 333a5cc

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_symbol_mangling/src/v0.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,9 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
771771
disambiguated_data: &DisambiguatedDefPathData,
772772
) -> Result<Self::Path, Self::Error> {
773773
let ns = match disambiguated_data.data {
774-
// FIXME: It shouldn't be necessary to add anything for extern block segments,
775-
// but we add 't' for backward compatibility.
776-
DefPathData::ForeignMod => 't',
774+
// Extern block segments can be skipped, names from extern blocks
775+
// are effectively living in their parent modules.
776+
DefPathData::ForeignMod => return print_prefix(self),
777777

778778
// Uppercase categories are more stable than lowercase ones.
779779
DefPathData::TypeNs(_) => 't',

src/test/ui/symbol-names/foreign-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// build-fail
2-
// compile-flags: -Z symbol-mangling-version=v0
2+
// compile-flags: -C symbol-mangling-version=v0
33

44
#![feature(extern_types)]
55
#![feature(rustc_attrs)]

src/test/ui/symbol-names/foreign-types.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvNtB<REF>_011ForeignTypeE)
1+
error: symbol-name(_RMCsCRATE_HASH_13foreign_typesINtB<REF>_5CheckNvB<REF>_11ForeignTypeE)
22
--> $DIR/foreign-types.rs:13:1
33
|
44
LL | #[rustc_symbol_name]

0 commit comments

Comments
 (0)