@@ -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,44 @@ 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| {
704
+ if tcx. dep_graph . is_fully_enabled ( ) {
705
+ tcx. allocator_kind_q ( ( ) )
706
+ } else {
707
+ CStore :: from_tcx ( tcx) . allocator_kind ( )
708
+ }
709
+ } ;
710
+ providers. hooks . alloc_error_handler_kind = |tcx| {
711
+ if tcx. dep_graph . is_fully_enabled ( ) {
712
+ tcx. alloc_error_handler_kind_q ( ( ) )
713
+ } else {
714
+ CStore :: from_tcx ( tcx) . alloc_error_handler_kind ( )
715
+ }
716
+ } ;
717
+ providers. hooks . has_global_allocator = |tcx, krate : CrateNum | {
718
+ if tcx. dep_graph . is_fully_enabled ( ) {
719
+ tcx. has_global_allocator_q ( krate)
720
+ } else {
721
+ if krate == LOCAL_CRATE {
722
+ CStore :: from_tcx ( tcx) . has_global_allocator ( )
723
+ } else {
724
+ * rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
725
+ & c. get_crate_data ( krate) . cdata . root . has_global_allocator
726
+ } )
727
+ }
728
+ }
729
+ } ;
730
+ providers. hooks . has_alloc_error_handler = |tcx, krate : CrateNum | {
731
+ if tcx. dep_graph . is_fully_enabled ( ) {
732
+ tcx. has_alloc_error_handler_q ( krate)
733
+ } else {
734
+ if krate == LOCAL_CRATE {
735
+ CStore :: from_tcx ( tcx) . has_alloc_error_handler ( )
736
+ } else {
737
+ * rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
738
+ & c. get_crate_data ( krate) . cdata . root . has_alloc_error_handler
739
+ } )
740
+ }
741
+ }
742
+ } ;
709
743
}
0 commit comments