Skip to content

Commit

Permalink
mangling_v0: Skip extern blocks during mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jan 8, 2022
1 parent 1b8daf8 commit 333a5cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_symbol_mangling/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/symbol-names/foreign-types.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/symbol-names/foreign-types.stderr
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 333a5cc

Please sign in to comment.