@@ -22,38 +22,15 @@ thread_local!(static OUT_DIR: Option<PathBuf> = {
2222} ) ;
2323thread_local ! ( static OUTPUT : RefCell <Option <File >> = RefCell :: new( None ) ) ;
2424
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 {
3126 let header = "old+generics,old,mw,mw+compression,new,new+compression" ;
3227
33- // Always compute all forms of mangling.
3428 let def_id = instance. def_id ( ) ;
3529 // FIXME(eddyb) this should ideally not be needed.
3630 let substs =
3731 tcx. normalize_erasing_regions ( ty:: ParamEnv :: reveal_all ( ) , instance. substs ) ;
3832
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 ) ;
5734
5835 OUTPUT . with ( |out| {
5936 let mut out = out. borrow_mut ( ) ;
@@ -93,6 +70,29 @@ pub fn record(
9370 }
9471
9572 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+
9696 writeln ! ( out, "{},{},{},{},{},{}" ,
9797 old_mangling_plus_generics,
9898 old_mangling,
@@ -124,17 +124,20 @@ pub fn record(
124124 cx. print_def_path ( def_id, substs) . unwrap ( ) . out
125125 }
126126 } ;
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);
128131 let expected_demangling = make_expected_demangling ( false ) ;
129132
130- for mangling in & [ & new_mangling, & new_mangling_plus_compression] {
133+ for mangling in & [ /* &new_mangling,*/ & new_mangling_plus_compression] {
131134 match rustc_demangle:: try_demangle ( mangling) {
132135 Ok ( demangling) => {
133- let demangling_alt = format ! ( "{:#}" , demangling) ;
136+ /* let demangling_alt = format!("{:#}", demangling);
134137 if demangling_alt.contains('?') {
135138 bug!("demangle(alt) printing failed for {:?}\n{:?}", mangling, demangling_alt);
136139 }
137- assert_eq ! ( demangling_alt, expected_demangling_alt) ;
140+ assert_eq!(demangling_alt, expected_demangling_alt);*/
138141
139142 let demangling = format ! ( "{}" , demangling) ;
140143 if demangling. contains ( '?' ) {
0 commit comments