@@ -180,22 +180,6 @@ impl<'tcx> Queries<'tcx> {
180
180
} )
181
181
}
182
182
183
- pub fn ongoing_codegen ( & ' tcx self ) -> Result < Box < dyn Any > > {
184
- self . global_ctxt ( ) ?. enter ( |tcx| {
185
- // Don't do code generation if there were any errors
186
- self . compiler . sess . compile_status ( ) ?;
187
-
188
- // If we have any delayed bugs, for example because we created TyKind::Error earlier,
189
- // it's likely that codegen will only cause more ICEs, obscuring the original problem
190
- self . compiler . sess . diagnostic ( ) . flush_delayed ( ) ;
191
-
192
- // Hook for UI tests.
193
- Self :: check_for_rustc_errors_attr ( tcx) ;
194
-
195
- Ok ( passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) )
196
- } )
197
- }
198
-
199
183
/// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used
200
184
/// to write UI tests that actually test that compilation succeeds without reporting
201
185
/// an error.
@@ -230,8 +214,20 @@ impl<'tcx> Queries<'tcx> {
230
214
}
231
215
}
232
216
233
- pub fn linker ( & ' tcx self , ongoing_codegen : Box < dyn Any > ) -> Result < Linker > {
217
+ pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
234
218
self . global_ctxt ( ) ?. enter ( |tcx| {
219
+ // Don't do code generation if there were any errors
220
+ self . compiler . sess . compile_status ( ) ?;
221
+
222
+ // If we have any delayed bugs, for example because we created TyKind::Error earlier,
223
+ // it's likely that codegen will only cause more ICEs, obscuring the original problem
224
+ self . compiler . sess . diagnostic ( ) . flush_delayed ( ) ;
225
+
226
+ // Hook for UI tests.
227
+ Self :: check_for_rustc_errors_attr ( tcx) ;
228
+
229
+ let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ;
230
+
235
231
Ok ( Linker {
236
232
dep_graph : tcx. dep_graph . clone ( ) ,
237
233
output_filenames : tcx. output_filenames ( ( ) ) . clone ( ) ,
0 commit comments