@@ -94,6 +94,10 @@ macro_rules! define_helper {
94
94
$tl. with( |c| c. set( self . 0 ) )
95
95
}
96
96
}
97
+
98
+ pub fn $name( ) -> bool {
99
+ $tl. with( |c| c. get( ) )
100
+ }
97
101
) +
98
102
}
99
103
}
@@ -676,7 +680,7 @@ pub trait PrettyPrinter<'tcx>:
676
680
p ! ( ")" )
677
681
}
678
682
ty:: FnDef ( def_id, substs) => {
679
- if NO_QUERIES . with ( |q| q . get ( ) ) {
683
+ if with_no_queries ( ) {
680
684
p ! ( print_def_path( def_id, substs) ) ;
681
685
} else {
682
686
let sig = self . tcx ( ) . fn_sig ( def_id) . subst ( self . tcx ( ) , substs) ;
@@ -732,7 +736,7 @@ pub trait PrettyPrinter<'tcx>:
732
736
p ! ( print_def_path( def_id, & [ ] ) ) ;
733
737
}
734
738
ty:: Alias ( ty:: Projection | ty:: Inherent | ty:: Weak , ref data) => {
735
- if !( self . should_print_verbose ( ) || NO_QUERIES . with ( |q| q . get ( ) ) )
739
+ if !( self . should_print_verbose ( ) || with_no_queries ( ) )
736
740
&& self . tcx ( ) . is_impl_trait_in_trait ( data. def_id )
737
741
{
738
742
return self . pretty_print_opaque_impl_type ( data. def_id , data. substs ) ;
@@ -779,7 +783,7 @@ pub trait PrettyPrinter<'tcx>:
779
783
return Ok ( self ) ;
780
784
}
781
785
_ => {
782
- if NO_QUERIES . with ( |q| q . get ( ) ) {
786
+ if with_no_queries ( ) {
783
787
p ! ( print_def_path( def_id, & [ ] ) ) ;
784
788
return Ok ( self ) ;
785
789
} else {
@@ -1746,7 +1750,8 @@ impl DerefMut for FmtPrinter<'_, '_> {
1746
1750
1747
1751
impl < ' a , ' tcx > FmtPrinter < ' a , ' tcx > {
1748
1752
pub fn new ( tcx : TyCtxt < ' tcx > , ns : Namespace ) -> Self {
1749
- Self :: new_with_limit ( tcx, ns, tcx. type_length_limit ( ) )
1753
+ let limit = if with_no_queries ( ) { Limit :: new ( 1048576 ) } else { tcx. type_length_limit ( ) } ;
1754
+ Self :: new_with_limit ( tcx, ns, limit)
1750
1755
}
1751
1756
1752
1757
pub fn new_with_limit ( tcx : TyCtxt < ' tcx > , ns : Namespace , type_length_limit : Limit ) -> Self {
0 commit comments