@@ -266,13 +266,7 @@ macro_rules! separate_provide_extern_default {
266266 ( )
267267 } ;
268268 ( [ ( separate_provide_extern) $( $rest: tt) * ] [ $name: ident] ) => {
269- |_, key| bug!(
270- "`tcx.{}({:?})` unsupported by its crate; \
271- perhaps the `{}` query was never assigned a provider function",
272- stringify!( $name) ,
273- key,
274- stringify!( $name) ,
275- )
269+ |_, key| $crate:: query:: plumbing:: default_extern_query( stringify!( $name) , & key)
276270 } ;
277271 ( [ $other: tt $( $modifiers: tt) * ] [ $( $args: tt) * ] ) => {
278272 separate_provide_extern_default!( [ $( $modifiers) * ] [ $( $args) * ] )
@@ -462,15 +456,7 @@ macro_rules! define_callbacks {
462456 impl Default for Providers {
463457 fn default ( ) -> Self {
464458 Providers {
465- $( $name: |_, key| bug!(
466- "`tcx.{}({:?})` is not supported for this key;\n \
467- hint: Queries can be either made to the local crate, or the external crate. \
468- This error means you tried to use it for one that's not supported.\n \
469- If that's not the case, {} was likely never assigned to a provider function.\n ",
470- stringify!( $name) ,
471- key,
472- stringify!( $name) ,
473- ) , ) *
459+ $( $name: |_, key| $crate:: query:: plumbing:: default_query( stringify!( $name) , & key) ) ,*
474460 }
475461 }
476462 }
@@ -661,3 +647,21 @@ use super::erase::EraseType;
661647
662648#[ derive( Copy , Clone , Debug , HashStable ) ]
663649pub struct CyclePlaceholder ( pub ErrorGuaranteed ) ;
650+
651+ #[ cold]
652+ pub ( crate ) fn default_query ( name : & str , key : & dyn std:: fmt:: Debug ) -> ! {
653+ bug ! (
654+ "`tcx.{name}({key:?})` is not supported for this key;\n \
655+ hint: Queries can be either made to the local crate, or the external crate. \
656+ This error means you tried to use it for one that's not supported.\n \
657+ If that's not the case, {name} was likely never assigned to a provider function.\n ",
658+ )
659+ }
660+
661+ #[ cold]
662+ pub ( crate ) fn default_extern_query ( name : & str , key : & dyn std:: fmt:: Debug ) -> ! {
663+ bug ! (
664+ "`tcx.{name}({key:?})` unsupported by its crate; \
665+ perhaps the `{name}` query was never assigned a provider function",
666+ )
667+ }
0 commit comments