@@ -37,7 +37,7 @@ use std::any::Any;
3737use rustc_codegen_ssa:: traits:: CodegenBackend ;
3838use rustc_codegen_ssa:: CodegenResults ;
3939use rustc_errors:: ErrorReported ;
40- use rustc_middle:: dep_graph:: { DepGraph , WorkProduct , WorkProductId } ;
40+ use rustc_middle:: dep_graph:: { WorkProduct , WorkProductId } ;
4141use rustc_middle:: middle:: cstore:: { EncodedMetadata , MetadataLoader } ;
4242use rustc_middle:: ty:: query:: Providers ;
4343use rustc_session:: config:: OutputFilenames ;
@@ -190,23 +190,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
190190 Box :: new ( crate :: metadata:: CraneliftMetadataLoader )
191191 }
192192
193- fn provide ( & self , providers : & mut Providers ) {
194- providers. supported_target_features = |tcx, cnum| {
195- assert_eq ! ( cnum, LOCAL_CRATE ) ;
196- if tcx. sess . opts . actually_rustdoc {
197- // rustdoc needs to be able to document functions that use all the features, so
198- // whitelist them all
199- rustc_codegen_ssa:: target_features:: all_known_features ( )
200- . map ( |( a, b) | ( a. to_string ( ) , b) )
201- . collect ( )
202- } else {
203- rustc_codegen_ssa:: target_features:: supported_target_features ( tcx. sess )
204- . iter ( )
205- . map ( |& ( a, b) | ( a. to_string ( ) , b) )
206- . collect ( )
207- }
208- } ;
209- }
193+ fn provide ( & self , _providers : & mut Providers ) { }
210194 fn provide_extern ( & self , _providers : & mut Providers ) { }
211195
212196 fn target_features ( & self , _sess : & Session ) -> Vec < rustc_span:: Symbol > {
@@ -229,34 +213,21 @@ impl CodegenBackend for CraneliftCodegenBackend {
229213 fn join_codegen (
230214 & self ,
231215 ongoing_codegen : Box < dyn Any > ,
232- sess : & Session ,
233- dep_graph : & DepGraph ,
234- ) -> Result < Box < dyn Any > , ErrorReported > {
235- let ( codegen_results, work_products) = * ongoing_codegen
216+ _sess : & Session ,
217+ ) -> Result < ( CodegenResults , FxHashMap < WorkProductId , WorkProduct > ) , ErrorReported > {
218+ Ok ( * ongoing_codegen
236219 . downcast :: < ( CodegenResults , FxHashMap < WorkProductId , WorkProduct > ) > ( )
237- . unwrap ( ) ;
238-
239- sess. time ( "serialize_work_products" , move || {
240- rustc_incremental:: save_work_product_index ( sess, & dep_graph, work_products)
241- } ) ;
242-
243- Ok ( Box :: new ( codegen_results) )
220+ . unwrap ( ) )
244221 }
245222
246223 fn link (
247224 & self ,
248225 sess : & Session ,
249- res : Box < dyn Any > ,
226+ codegen_results : CodegenResults ,
250227 outputs : & OutputFilenames ,
251228 ) -> Result < ( ) , ErrorReported > {
252229 use rustc_codegen_ssa:: back:: link:: link_binary;
253230
254- sess. abort_if_errors ( ) ;
255-
256- let codegen_results = * res
257- . downcast :: < CodegenResults > ( )
258- . expect ( "Expected CraneliftCodegenBackend's CodegenResult, found Box<Any>" ) ;
259-
260231 let _timer = sess. prof . generic_activity ( "link_crate" ) ;
261232
262233 sess. time ( "linking" , || {
@@ -270,8 +241,6 @@ impl CodegenBackend for CraneliftCodegenBackend {
270241 ) ;
271242 } ) ;
272243
273- rustc_incremental:: finalize_session_directory ( sess, codegen_results. crate_hash ) ;
274-
275244 Ok ( ( ) )
276245 }
277246}
0 commit comments