about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-12-27 20:09:20 +0800
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-01-08 11:53:13 +0800
commit333a5cc3691a96aab461ebcbc6064ee79356f1ae (patch)
tree2c04ee555d77447a5a31621badf49e336edce551
parent1b8daf8c58267a5d9fae2021a311dfbbda11b02f (diff)
downloadrust-333a5cc3691a96aab461ebcbc6064ee79356f1ae.tar.gz
rust-333a5cc3691a96aab461ebcbc6064ee79356f1ae.zip
mangling_v0: Skip extern blocks during mangling
-rw-r--r--compiler/rustc_symbol_mangling/src/v0.rs6
-rw-r--r--src/test/ui/symbol-names/foreign-types.rs2
-rw-r--r--src/test/ui/symbol-names/foreign-types.stderr2
3 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs
index c2519adcbe4..fbb9e28d182 100644
--- a/compiler/rustc_symbol_mangling/src/v0.rs
+++ b/compiler/rustc_symbol_mangling/src/v0.rs
@@ -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',
diff --git a/src/test/ui/symbol-names/foreign-types.rs b/src/test/ui/symbol-names/foreign-types.rs
index 33c5e6adfef..8f5b07769ca 100644
--- a/src/test/ui/symbol-names/foreign-types.rs
+++ b/src/test/ui/symbol-names/foreign-types.rs
@@ -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)]
diff --git a/src/test/ui/symbol-names/foreign-types.stderr b/src/test/ui/symbol-names/foreign-types.stderr
index c6c59a6c82e..fcffdd2a8ec 100644
--- a/src/test/ui/symbol-names/foreign-types.stderr
+++ b/src/test/ui/symbol-names/foreign-types.stderr
@@ -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]