mangling_v0: Skip extern blocks during mangling

This commit is contained in:
Vadim Petrochenkov 2021-12-27 20:09:20 +08:00
parent 1b8daf8c58
commit 333a5cc369
3 changed files with 5 additions and 5 deletions

View file

@ -771,9 +771,9 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
disambiguated_data: &DisambiguatedDefPathData,
) -> Result<Self::Path, Self::Error> {
let ns = match disambiguated_data.data {
// FIXME: It shouldn't be necessary to add anything for extern block segments,
// but we add 't' for backward compatibility.
DefPathData::ForeignMod => 't',
// Extern block segments can be skipped, names from extern blocks
// are effectively living in their parent modules.
DefPathData::ForeignMod => return print_prefix(self),
// Uppercase categories are more stable than lowercase ones.
DefPathData::TypeNs(_) => 't',

View file

@ -1,5 +1,5 @@
// build-fail
// compile-flags: -Z symbol-mangling-version=v0
// compile-flags: -C symbol-mangling-version=v0
#![feature(extern_types)]
#![feature(rustc_attrs)]

View file

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