File tree 3 files changed +7
-5
lines changed
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ use rustc_mir::monomorphize::Instance;
114
114
use syntax_pos:: symbol:: Symbol ;
115
115
116
116
use std:: fmt:: Write ;
117
+ use std:: mem:: discriminant;
117
118
118
119
pub fn provide ( providers : & mut Providers ) {
119
120
* providers = Providers {
@@ -220,8 +221,9 @@ fn get_symbol_hash<'a, 'tcx>(
220
221
( & tcx. crate_disambiguator ( instantiating_crate) ) . hash_stable ( & mut hcx, & mut hasher) ;
221
222
}
222
223
223
- let is_vtable_shim = instance. is_vtable_shim ( ) ;
224
- is_vtable_shim. hash_stable ( & mut hcx, & mut hasher) ;
224
+ // We want to avoid accidental collision between different types of instances.
225
+ // Especially, VtableShim may overlap with its original instance without this.
226
+ discriminant ( & instance. def ) . hash_stable ( & mut hcx, & mut hasher) ;
225
227
} ) ;
226
228
227
229
// 64 bits should be enough to avoid collisions.
Original file line number Diff line number Diff line change 1
- error: symbol-name(_ZN5basic4main17h6ab1850bb0b9f417E )
1
+ error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E )
2
2
--> $DIR/basic.rs:13:1
3
3
|
4
4
LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main
Original file line number Diff line number Diff line change 1
- error: symbol-name(_ZN5impl13foo3Foo3bar17h99c48478d64a0eb0E )
1
+ error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E )
2
2
--> $DIR/impl1.rs:18:9
3
3
|
4
4
LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
@@ -10,7 +10,7 @@ error: item-path(foo::Foo::bar)
10
10
LL | #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar)
11
11
| ^^^^^^^^^^^^^^^^^^
12
12
13
- error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17hebf13830acf865d9E )
13
+ error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E )
14
14
--> $DIR/impl1.rs:28:9
15
15
|
16
16
LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
You can’t perform that action at this time.
0 commit comments