@@ -22,38 +22,15 @@ thread_local!(static OUT_DIR: Option<PathBuf> = {
22
22
} ) ;
23
23
thread_local ! ( static OUTPUT : RefCell <Option <File >> = RefCell :: new( None ) ) ;
24
24
25
- pub fn record (
26
- tcx : TyCtxt < ' _ , ' tcx , ' tcx > ,
27
- instance : Instance < ' tcx > ,
28
- old_mangling : & str ,
29
- old_hash : u64 ,
30
- ) -> String {
25
+ pub fn record ( tcx : TyCtxt < ' _ , ' tcx , ' tcx > , instance : Instance < ' tcx > ) -> String {
31
26
let header = "old+generics,old,mw,mw+compression,new,new+compression" ;
32
27
33
- // Always compute all forms of mangling.
34
28
let def_id = instance. def_id ( ) ;
35
29
// FIXME(eddyb) this should ideally not be needed.
36
30
let substs =
37
31
tcx. normalize_erasing_regions ( ty:: ParamEnv :: reveal_all ( ) , instance. substs ) ;
38
32
39
- let old_mangling_plus_generics = {
40
- let mut symbol_path = old:: SymbolPrinter {
41
- tcx,
42
- path : old:: SymbolPath :: new ( ) ,
43
- keep_within_component : false ,
44
- } . print_def_path ( def_id, substs) . unwrap ( ) . path ;
45
-
46
- if instance. is_vtable_shim ( ) {
47
- symbol_path. finalize_pending_component ( ) ;
48
- old:: sanitize ( & mut symbol_path. temp_buf , "{{vtable-shim}}" ) ;
49
- }
50
-
51
- symbol_path. finish ( old_hash)
52
- } ;
53
-
54
- let ( mw_mangling, mw_mangling_plus_compression) = mw:: mangle ( tcx, instance)
55
- . unwrap_or ( ( String :: new ( ) , String :: new ( ) ) ) ;
56
- let ( new_mangling, new_mangling_plus_compression) = new:: mangle ( tcx, instance) ;
33
+ let new_mangling_plus_compression = new:: mangle ( tcx, instance, true ) ;
57
34
58
35
OUTPUT . with ( |out| {
59
36
let mut out = out. borrow_mut ( ) ;
@@ -93,6 +70,29 @@ pub fn record(
93
70
}
94
71
95
72
if let Some ( out) = out. as_mut ( ) {
73
+ let ( old_mangling, old_hash) =
74
+ old:: compute_old_mangled_symbol_name ( tcx, instance) ;
75
+
76
+ let old_mangling_plus_generics = {
77
+ let mut symbol_path = old:: SymbolPrinter {
78
+ tcx,
79
+ path : old:: SymbolPath :: new ( ) ,
80
+ keep_within_component : false ,
81
+ } . print_def_path ( def_id, substs) . unwrap ( ) . path ;
82
+
83
+ if instance. is_vtable_shim ( ) {
84
+ symbol_path. finalize_pending_component ( ) ;
85
+ old:: sanitize ( & mut symbol_path. temp_buf , "{{vtable-shim}}" ) ;
86
+ }
87
+
88
+ symbol_path. finish ( old_hash)
89
+ } ;
90
+
91
+ let ( mw_mangling, mw_mangling_plus_compression) = mw:: mangle ( tcx, instance)
92
+ . unwrap_or ( ( String :: new ( ) , String :: new ( ) ) ) ;
93
+
94
+ let new_mangling = new:: mangle ( tcx, instance, false ) ;
95
+
96
96
writeln ! ( out, "{},{},{},{},{},{}" ,
97
97
old_mangling_plus_generics,
98
98
old_mangling,
@@ -124,17 +124,20 @@ pub fn record(
124
124
cx. print_def_path ( def_id, substs) . unwrap ( ) . out
125
125
}
126
126
} ;
127
- let expected_demangling_alt = make_expected_demangling ( true ) ;
127
+
128
+ // HACK(eddyb) some parts are commented out to reduce check overhead:
129
+
130
+ // let expected_demangling_alt = make_expected_demangling(true);
128
131
let expected_demangling = make_expected_demangling ( false ) ;
129
132
130
- for mangling in & [ & new_mangling, & new_mangling_plus_compression] {
133
+ for mangling in & [ /* &new_mangling,*/ & new_mangling_plus_compression] {
131
134
match rustc_demangle:: try_demangle ( mangling) {
132
135
Ok ( demangling) => {
133
- let demangling_alt = format ! ( "{:#}" , demangling) ;
136
+ /* let demangling_alt = format!("{:#}", demangling);
134
137
if demangling_alt.contains('?') {
135
138
bug!("demangle(alt) printing failed for {:?}\n{:?}", mangling, demangling_alt);
136
139
}
137
- assert_eq ! ( demangling_alt, expected_demangling_alt) ;
140
+ assert_eq!(demangling_alt, expected_demangling_alt);*/
138
141
139
142
let demangling = format ! ( "{}" , demangling) ;
140
143
if demangling. contains ( '?' ) {
0 commit comments