about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMasaki Hara <ackie.h.gmai@gmail.com>2018-09-10 23:01:46 +0900
committerMasaki Hara <ackie.h.gmai@gmail.com>2018-10-24 21:59:06 +0900
commit824315a7220895b0e21783726eb2b7856bc27406 (patch)
treeb5a14c2c03209e1609f9636a391297c9f80aae72
parent6fd914a1afc3d0d0f86e8a9a1bfacd55be053d58 (diff)
downloadrust-824315a7220895b0e21783726eb2b7856bc27406.tar.gz
rust-824315a7220895b0e21783726eb2b7856bc27406.zip
Distinguish vtable shims in symbol paths.
-rw-r--r--src/librustc_codegen_utils/symbol_names.rs11
-rw-r--r--src/test/ui/symbol-names/basic.stderr2
-rw-r--r--src/test/ui/symbol-names/impl1.stderr4
3 files changed, 13 insertions, 4 deletions
diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs
index c1e80234a77..27700bab245 100644
--- a/src/librustc_codegen_utils/symbol_names.rs
+++ b/src/librustc_codegen_utils/symbol_names.rs
@@ -219,6 +219,9 @@ fn get_symbol_hash<'a, 'tcx>(
                 .hash_stable(&mut hcx, &mut hasher);
             (&tcx.crate_disambiguator(instantiating_crate)).hash_stable(&mut hcx, &mut hasher);
         }
+
+        let is_vtable_shim = instance.is_vtable_shim();
+        is_vtable_shim.hash_stable(&mut hcx, &mut hasher);
     });
 
     // 64 bits should be enough to avoid collisions.
@@ -322,7 +325,13 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
 
     let hash = get_symbol_hash(tcx, def_id, instance, instance_ty, substs);
 
-    SymbolPathBuffer::from_interned(tcx.def_symbol_name(def_id)).finish(hash)
+    let mut buf = SymbolPathBuffer::from_interned(tcx.def_symbol_name(def_id));
+
+    if instance.is_vtable_shim() {
+        buf.push("{{vtable-shim}}");
+    }
+
+    buf.finish(hash)
 }
 
 // Follow C++ namespace-mangling style, see
diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr
index eeeb1b5e34d..5e910caf3c0 100644
--- a/src/test/ui/symbol-names/basic.stderr
+++ b/src/test/ui/symbol-names/basic.stderr
@@ -1,4 +1,4 @@
-error: symbol-name(_ZN5basic4main17h2138d548fb9814b6E)
+error: symbol-name(_ZN5basic4main17h6ab1850bb0b9f417E)
   --> $DIR/basic.rs:13:1
    |
 LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main
diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr
index edce6929695..46e260bc28c 100644
--- a/src/test/ui/symbol-names/impl1.stderr
+++ b/src/test/ui/symbol-names/impl1.stderr
@@ -1,4 +1,4 @@
-error: symbol-name(_ZN5impl13foo3Foo3bar17h8da62e6147ff602fE)
+error: symbol-name(_ZN5impl13foo3Foo3bar17h99c48478d64a0eb0E)
   --> $DIR/impl1.rs:18:9
    |
 LL |         #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
@@ -10,7 +10,7 @@ error: item-path(foo::Foo::bar)
 LL |         #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar)
    |         ^^^^^^^^^^^^^^^^^^
 
-error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h374cb8f6185db9b4E)
+error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17hebf13830acf865d9E)
   --> $DIR/impl1.rs:28:9
    |
 LL |         #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz