@@ -390,13 +390,12 @@ macro_rules! define_queries {
390390
391391 #[ inline]
392392 fn compute( tcx: QueryCtxt <' tcx>, key: Self :: Key ) -> Self :: Value {
393- let provider = tcx. queries. providers. get( key. query_crate( ) )
394- // HACK(eddyb) it's possible crates may be loaded after
395- // the query engine is created, and because crate loading
396- // is not yet integrated with the query engine, such crates
397- // would be missing appropriate entries in `providers`.
398- . unwrap_or( & tcx. queries. fallback_extern_providers)
399- . $name;
393+ let is_local = key. query_crate( ) == LOCAL_CRATE ;
394+ let provider = if is_local {
395+ tcx. queries. local_providers. $name
396+ } else {
397+ tcx. queries. extern_providers. $name
398+ } ;
400399 provider( * tcx, key)
401400 }
402401
@@ -507,8 +506,8 @@ macro_rules! define_queries_struct {
507506 ( tcx: $tcx: tt,
508507 input: ( $( ( [ $( $modifiers: tt) * ] [ $( $attr: tt) * ] [ $name: ident] ) ) * ) ) => {
509508 pub struct Queries <$tcx> {
510- providers : IndexVec < CrateNum , Providers >,
511- fallback_extern_providers : Box <Providers >,
509+ local_providers : Box < Providers >,
510+ extern_providers : Box <Providers >,
512511
513512 $( $( #[ $attr] ) * $name: QueryState <
514513 crate :: dep_graph:: DepKind ,
@@ -518,12 +517,12 @@ macro_rules! define_queries_struct {
518517
519518 impl <$tcx> Queries <$tcx> {
520519 pub fn new(
521- providers : IndexVec < CrateNum , Providers > ,
522- fallback_extern_providers : Providers ,
520+ local_providers : Providers ,
521+ extern_providers : Providers ,
523522 ) -> Self {
524523 Queries {
525- providers ,
526- fallback_extern_providers : Box :: new( fallback_extern_providers ) ,
524+ local_providers : Box :: new ( local_providers ) ,
525+ extern_providers : Box :: new( extern_providers ) ,
527526 $( $name: Default :: default ( ) ) ,*
528527 }
529528 }
0 commit comments