@@ -116,35 +116,6 @@ impl<'tcx> Queries<'tcx> {
116
116
)
117
117
} )
118
118
}
119
-
120
- pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
121
- self . global_ctxt ( ) ?. enter ( |tcx| {
122
- let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ?;
123
-
124
- // This must run after monomorphization so that all generic types
125
- // have been instantiated.
126
- if tcx. sess . opts . unstable_opts . print_type_sizes {
127
- tcx. sess . code_stats . print_type_sizes ( ) ;
128
- }
129
-
130
- if tcx. sess . opts . unstable_opts . print_vtable_sizes {
131
- let crate_name = tcx. crate_name ( LOCAL_CRATE ) ;
132
-
133
- tcx. sess . code_stats . print_vtable_sizes ( crate_name) ;
134
- }
135
-
136
- Ok ( Linker {
137
- dep_graph : tcx. dep_graph . clone ( ) ,
138
- output_filenames : tcx. output_filenames ( ( ) ) . clone ( ) ,
139
- crate_hash : if tcx. needs_crate_hash ( ) {
140
- Some ( tcx. crate_hash ( LOCAL_CRATE ) )
141
- } else {
142
- None
143
- } ,
144
- ongoing_codegen,
145
- } )
146
- } )
147
- }
148
119
}
149
120
150
121
pub struct Linker {
@@ -156,6 +127,36 @@ pub struct Linker {
156
127
}
157
128
158
129
impl Linker {
130
+ pub fn codegen_and_build_linker (
131
+ tcx : TyCtxt < ' _ > ,
132
+ codegen_backend : & dyn CodegenBackend ,
133
+ ) -> Result < Linker > {
134
+ let ongoing_codegen = passes:: start_codegen ( codegen_backend, tcx) ?;
135
+
136
+ // This must run after monomorphization so that all generic types
137
+ // have been instantiated.
138
+ if tcx. sess . opts . unstable_opts . print_type_sizes {
139
+ tcx. sess . code_stats . print_type_sizes ( ) ;
140
+ }
141
+
142
+ if tcx. sess . opts . unstable_opts . print_vtable_sizes {
143
+ let crate_name = tcx. crate_name ( LOCAL_CRATE ) ;
144
+
145
+ tcx. sess . code_stats . print_vtable_sizes ( crate_name) ;
146
+ }
147
+
148
+ Ok ( Linker {
149
+ dep_graph : tcx. dep_graph . clone ( ) ,
150
+ output_filenames : tcx. output_filenames ( ( ) ) . clone ( ) ,
151
+ crate_hash : if tcx. needs_crate_hash ( ) {
152
+ Some ( tcx. crate_hash ( LOCAL_CRATE ) )
153
+ } else {
154
+ None
155
+ } ,
156
+ ongoing_codegen,
157
+ } )
158
+ }
159
+
159
160
pub fn link ( self , sess : & Session , codegen_backend : & dyn CodegenBackend ) -> Result < ( ) > {
160
161
let ( codegen_results, work_products) =
161
162
codegen_backend. join_codegen ( self . ongoing_codegen , sess, & self . output_filenames ) ;
0 commit comments