Distinguish vtable shims in symbol paths.

This commit is contained in:
Masaki Hara 2018-09-10 23:01:46 +09:00
parent 6fd914a1af
commit 824315a722
3 changed files with 13 additions and 4 deletions

View 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

View File

@ -1,4 +1,4 @@
error: symbol-name(_ZN5basic4main17h2138d548fb9814b6E)
error: symbol-name(_ZN5basic4main17h6ab1850bb0b9f417E)
--> $DIR/basic.rs:13:1
|
LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main

View 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