@@ -5,15 +5,14 @@ use rustc_index::vec::IndexVec;
55use rustc_middle:: ty:: adjustment:: PointerCast ;
66use rustc_middle:: ty:: layout:: FnAbiOf ;
77use rustc_middle:: ty:: print:: with_no_trimmed_paths;
8- use rustc_middle:: ty:: SymbolName ;
98
109use crate :: constant:: ConstantCx ;
1110use crate :: debuginfo:: FunctionDebugContext ;
1211use crate :: prelude:: * ;
1312use crate :: pretty_clif:: CommentWriter ;
1413
15- struct CodegenedFunction < ' tcx > {
16- symbol_name : SymbolName < ' tcx > ,
14+ struct CodegenedFunction {
15+ symbol_name : String ,
1716 func_id : FuncId ,
1817 func : Function ,
1918 clif_comments : CommentWriter ,
@@ -42,7 +41,7 @@ fn codegen_fn<'tcx>(
4241 cached_func : Function ,
4342 module : & mut dyn Module ,
4443 instance : Instance < ' tcx > ,
45- ) -> CodegenedFunction < ' tcx > {
44+ ) -> CodegenedFunction {
4645 debug_assert ! ( !instance. substs. needs_infer( ) ) ;
4746
4847 let mir = tcx. instance_mir ( instance. def ) ;
@@ -56,9 +55,9 @@ fn codegen_fn<'tcx>(
5655 } ) ;
5756
5857 // Declare function
59- let symbol_name = tcx. symbol_name ( instance) ;
58+ let symbol_name = tcx. symbol_name ( instance) . name . to_string ( ) ;
6059 let sig = get_function_sig ( tcx, module. isa ( ) . triple ( ) , instance) ;
61- let func_id = module. declare_function ( symbol_name. name , Linkage :: Local , & sig) . unwrap ( ) ;
60+ let func_id = module. declare_function ( & symbol_name, Linkage :: Local , & sig) . unwrap ( ) ;
6261
6362 // Make the FunctionBuilder
6463 let mut func_ctx = FunctionBuilderContext :: new ( ) ;
@@ -81,7 +80,7 @@ fn codegen_fn<'tcx>(
8180 let clif_comments = crate :: pretty_clif:: CommentWriter :: new ( tcx, instance) ;
8281
8382 let func_debug_cx = if let Some ( debug_context) = & mut cx. debug_context {
84- Some ( debug_context. define_function ( tcx, symbol_name. name , mir. span ) )
83+ Some ( debug_context. define_function ( tcx, & symbol_name, mir. span ) )
8584 } else {
8685 None
8786 } ;
@@ -113,6 +112,7 @@ fn codegen_fn<'tcx>(
113112 tcx. sess . time ( "codegen clif ir" , || codegen_fn_body ( & mut fx, start_block) ) ;
114113
115114 // Recover all necessary data from fx, before accessing func will prevent future access to it.
115+ let symbol_name = fx. symbol_name ;
116116 let clif_comments = fx. clif_comments ;
117117 let func_debug_cx = fx. func_debug_cx ;
118118
@@ -121,7 +121,7 @@ fn codegen_fn<'tcx>(
121121 if cx. should_write_ir {
122122 crate :: pretty_clif:: write_clif_file (
123123 tcx. output_filenames ( ( ) ) ,
124- symbol_name. name ,
124+ & symbol_name,
125125 "unopt" ,
126126 module. isa ( ) ,
127127 & func,
@@ -135,11 +135,11 @@ fn codegen_fn<'tcx>(
135135 CodegenedFunction { symbol_name, func_id, func, clif_comments, func_debug_cx }
136136}
137137
138- fn compile_fn < ' tcx > (
138+ fn compile_fn (
139139 cx : & mut crate :: CodegenCx ,
140140 cached_context : & mut Context ,
141141 module : & mut dyn Module ,
142- codegened_func : CodegenedFunction < ' tcx > ,
142+ codegened_func : CodegenedFunction ,
143143) {
144144 let clif_comments = codegened_func. clif_comments ;
145145
@@ -195,7 +195,7 @@ fn compile_fn<'tcx>(
195195 // Write optimized function to file for debugging
196196 crate :: pretty_clif:: write_clif_file (
197197 & cx. output_filenames ,
198- codegened_func. symbol_name . name ,
198+ & codegened_func. symbol_name ,
199199 "opt" ,
200200 module. isa ( ) ,
201201 & context. func ,
@@ -205,7 +205,7 @@ fn compile_fn<'tcx>(
205205 if let Some ( disasm) = & context. compiled_code ( ) . unwrap ( ) . disasm {
206206 crate :: pretty_clif:: write_ir_file (
207207 & cx. output_filenames ,
208- & format ! ( "{}.vcode" , codegened_func. symbol_name. name ) ,
208+ & format ! ( "{}.vcode" , codegened_func. symbol_name) ,
209209 |file| file. write_all ( disasm. as_bytes ( ) ) ,
210210 )
211211 }
0 commit comments