@@ -328,8 +328,8 @@ provide! { tcx, def_id, other, cdata,
328328 is_private_dep => { cdata. private_dep }
329329 is_panic_runtime => { cdata. root. panic_runtime }
330330 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 }
331+ has_global_allocator_q => { cdata. root. has_global_allocator }
332+ has_alloc_error_handler_q => { cdata. root. has_alloc_error_handler }
333333 has_panic_handler => { cdata. root. has_panic_handler }
334334 is_profiler_runtime => { cdata. root. profiler_runtime }
335335 required_panic_strategy => { cdata. root. required_panic_strategy }
@@ -407,8 +407,8 @@ provide! { tcx, def_id, other, cdata,
407407pub ( in crate :: rmeta) fn provide ( providers : & mut Providers ) {
408408 provide_cstore_hooks ( providers) ;
409409 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 ( ) ,
410+ allocator_kind_q : |tcx, ( ) | CStore :: from_tcx ( tcx) . allocator_kind ( ) ,
411+ alloc_error_handler_kind_q : |tcx, ( ) | CStore :: from_tcx ( tcx) . alloc_error_handler_kind ( ) ,
412412 is_private_dep : |_tcx, LocalCrate | false ,
413413 native_library : |tcx, id| {
414414 tcx. native_libraries ( id. krate )
@@ -519,8 +519,10 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
519519 } ,
520520
521521 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 ( ) ,
522+ has_global_allocator_q : |tcx, LocalCrate | CStore :: from_tcx ( tcx) . has_global_allocator ( ) ,
523+ has_alloc_error_handler_q : |tcx, LocalCrate | {
524+ CStore :: from_tcx ( tcx) . has_alloc_error_handler ( )
525+ } ,
524526 postorder_cnums : |tcx, ( ) | {
525527 tcx. arena . alloc_from_iter (
526528 CStore :: from_tcx ( tcx) . crate_dependencies_in_postorder ( LOCAL_CRATE ) . into_iter ( ) ,
@@ -706,4 +708,44 @@ fn provide_cstore_hooks(providers: &mut Providers) {
706708 cdata. imported_source_file ( file_index as u32 , tcx. sess ) ;
707709 }
708710 } ;
711+ providers. hooks . allocator_kind = |tcx| {
712+ if tcx. dep_graph . is_fully_enabled ( ) {
713+ tcx. allocator_kind_q ( ( ) )
714+ } else {
715+ CStore :: from_tcx ( tcx) . allocator_kind ( )
716+ }
717+ } ;
718+ providers. hooks . alloc_error_handler_kind = |tcx| {
719+ if tcx. dep_graph . is_fully_enabled ( ) {
720+ tcx. alloc_error_handler_kind_q ( ( ) )
721+ } else {
722+ CStore :: from_tcx ( tcx) . alloc_error_handler_kind ( )
723+ }
724+ } ;
725+ providers. hooks . has_global_allocator = |tcx, krate : CrateNum | {
726+ if tcx. dep_graph . is_fully_enabled ( ) {
727+ tcx. has_global_allocator_q ( krate)
728+ } else {
729+ if krate == LOCAL_CRATE {
730+ CStore :: from_tcx ( tcx) . has_global_allocator ( )
731+ } else {
732+ * rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
733+ & c. get_crate_data ( krate) . cdata . root . has_global_allocator
734+ } )
735+ }
736+ }
737+ } ;
738+ providers. hooks . has_alloc_error_handler = |tcx, krate : CrateNum | {
739+ if tcx. dep_graph . is_fully_enabled ( ) {
740+ tcx. has_alloc_error_handler_q ( krate)
741+ } else {
742+ if krate == LOCAL_CRATE {
743+ CStore :: from_tcx ( tcx) . has_alloc_error_handler ( )
744+ } else {
745+ * rustc_data_structures:: sync:: FreezeReadGuard :: map ( CStore :: from_tcx ( tcx) , |c| {
746+ & c. get_crate_data ( krate) . cdata . root . has_alloc_error_handler
747+ } )
748+ }
749+ }
750+ } ;
709751}
0 commit comments