@@ -328,8 +328,6 @@ provide! { tcx, def_id, other, cdata,
328
328
is_private_dep => { cdata. private_dep }
329
329
is_panic_runtime => { cdata. root. panic_runtime }
330
330
is_compiler_builtins => { cdata. root. compiler_builtins }
331
- has_global_allocator => { cdata. root. has_global_allocator }
332
- has_alloc_error_handler => { cdata. root. has_alloc_error_handler }
333
331
has_panic_handler => { cdata. root. has_panic_handler }
334
332
is_profiler_runtime => { cdata. root. profiler_runtime }
335
333
required_panic_strategy => { cdata. root. required_panic_strategy }
@@ -407,8 +405,6 @@ provide! { tcx, def_id, other, cdata,
407
405
pub ( in crate :: rmeta) fn provide ( providers : & mut Providers ) {
408
406
provide_cstore_hooks ( providers) ;
409
407
providers. queries = rustc_middle:: query:: Providers {
410
- allocator_kind : |tcx, ( ) | CStore :: from_tcx ( tcx) . allocator_kind ( ) ,
411
- alloc_error_handler_kind : |tcx, ( ) | CStore :: from_tcx ( tcx) . alloc_error_handler_kind ( ) ,
412
408
is_private_dep : |_tcx, LocalCrate | false ,
413
409
native_library : |tcx, id| {
414
410
tcx. native_libraries ( id. krate )
@@ -519,8 +515,6 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
519
515
} ,
520
516
521
517
dependency_formats : |tcx, ( ) | Arc :: new ( crate :: dependency_format:: calculate ( tcx) ) ,
522
- has_global_allocator : |tcx, LocalCrate | CStore :: from_tcx ( tcx) . has_global_allocator ( ) ,
523
- has_alloc_error_handler : |tcx, LocalCrate | CStore :: from_tcx ( tcx) . has_alloc_error_handler ( ) ,
524
518
postorder_cnums : |tcx, ( ) | {
525
519
tcx. arena . alloc_from_iter (
526
520
CStore :: from_tcx ( tcx) . crate_dependencies_in_postorder ( LOCAL_CRATE ) . into_iter ( ) ,
@@ -706,4 +700,33 @@ fn provide_cstore_hooks(providers: &mut Providers) {
706
700
cdata. imported_source_file ( file_index as u32 , tcx. sess ) ;
707
701
}
708
702
} ;
703
+ providers. hooks . allocator_kind = |tcx| CStore :: from_tcx ( tcx) . allocator_kind ( ) ;
704
+ providers. hooks . alloc_error_handler_kind =
705
+ |tcx| CStore :: from_tcx ( tcx) . alloc_error_handler_kind ( ) ;
706
+ providers. hooks . has_global_allocator = |tcx, krate : CrateNum | {
707
+ if krate == LOCAL_CRATE {
708
+ CStore :: from_tcx ( tcx) . has_global_allocator ( )
709
+ } else {
710
+ let cdata =
711
+ rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
712
+ c. get_crate_data ( krate) . cdata
713
+ } ) ;
714
+ let cdata =
715
+ crate :: creader:: CrateMetadataRef { cdata : & cdata, cstore : & CStore :: from_tcx ( tcx) } ;
716
+ cdata. root . has_global_allocator
717
+ }
718
+ } ;
719
+ providers. hooks . has_alloc_error_handler = |tcx, krate : CrateNum | {
720
+ if krate == LOCAL_CRATE {
721
+ CStore :: from_tcx ( tcx) . has_alloc_error_handler ( )
722
+ } else {
723
+ let cdata =
724
+ rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
725
+ c. get_crate_data ( krate) . cdata
726
+ } ) ;
727
+ let cdata =
728
+ crate :: creader:: CrateMetadataRef { cdata : & cdata, cstore : & CStore :: from_tcx ( tcx) } ;
729
+ cdata. root . has_alloc_error_handler
730
+ }
731
+ }
709
732
}
0 commit comments