]> git.lizzy.rs Git - rust.git/commitdiff
Distinguish vtable shims in symbol paths.
authorMasaki Hara <ackie.h.gmai@gmail.com>
Mon, 10 Sep 2018 14:01:46 +0000 (23:01 +0900)
committerMasaki Hara <ackie.h.gmai@gmail.com>
Wed, 24 Oct 2018 12:59:06 +0000 (21:59 +0900)
src/librustc_codegen_utils/symbol_names.rs
src/test/ui/symbol-names/basic.stderr
src/test/ui/symbol-names/impl1.stderr

index c1e80234a775010067889c7dbb855e541a811e25..27700bab2455056b5fa9d8d37f109b765bb6d3ef 100644 (file)
@@ -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
index eeeb1b5e34d8b5a7f421052cff526d9c68475e06..5e910caf3c08fb00a02dd61567b70b6d3879fc7f 100644 (file)
@@ -1,4 +1,4 @@
-error: symbol-name(_ZN5basic4main17h2138d548fb9814b6E)
+error: symbol-name(_ZN5basic4main17h6ab1850bb0b9f417E)
   --> $DIR/basic.rs:13:1
    |
 LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main
index edce6929695563508bd83d36762c3643d7b95dd8..46e260bc28cc531c29cc40284592f52668e1e027 100644 (file)
@@ -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