@@ -675,8 +675,12 @@ pub trait PrettyPrinter<'tcx>:
675675 p ! ( ")" )
676676 }
677677 ty:: FnDef ( def_id, substs) => {
678- let sig = self . tcx ( ) . fn_sig ( def_id) . subst ( self . tcx ( ) , substs) ;
679- p ! ( print( sig) , " {{" , print_value_path( def_id, substs) , "}}" ) ;
678+ if NO_QUERIES . with ( |q| q. get ( ) ) {
679+ p ! ( print_def_path( def_id, substs) ) ;
680+ } else {
681+ let sig = self . tcx ( ) . fn_sig ( def_id) . subst ( self . tcx ( ) , substs) ;
682+ p ! ( print( sig) , " {{" , print_value_path( def_id, substs) , "}}" ) ;
683+ }
680684 }
681685 ty:: FnPtr ( ref bare_fn) => p ! ( print( bare_fn) ) ,
682686 ty:: Infer ( infer_ty) => {
@@ -732,20 +736,22 @@ pub trait PrettyPrinter<'tcx>:
732736 }
733737 ty:: Placeholder ( placeholder) => p ! ( write( "Placeholder({:?})" , placeholder) ) ,
734738 ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id, substs, .. } ) => {
735- // FIXME(eddyb) print this with `print_def_path`.
736739 // We use verbose printing in 'NO_QUERIES' mode, to
737740 // avoid needing to call `predicates_of`. This should
738741 // only affect certain debug messages (e.g. messages printed
739742 // from `rustc_middle::ty` during the computation of `tcx.predicates_of`),
740743 // and should have no effect on any compiler output.
741- if self . should_print_verbose ( ) || NO_QUERIES . with ( |q| q. get ( ) ) {
744+ if self . should_print_verbose ( ) {
745+ // FIXME(eddyb) print this with `print_def_path`.
742746 p ! ( write( "Opaque({:?}, {:?})" , def_id, substs) ) ;
743747 return Ok ( self ) ;
744748 }
745749
746750 let parent = self . tcx ( ) . parent ( def_id) ;
747751 match self . tcx ( ) . def_kind ( parent) {
748752 DefKind :: TyAlias | DefKind :: AssocTy => {
753+ // NOTE: I know we should check for NO_QUERIES here, but it's alright.
754+ // `type_of` on a TAIT should never cause a cycle.
749755 if let ty:: Alias ( ty:: Opaque , ty:: AliasTy { def_id : d, .. } ) =
750756 * self . tcx ( ) . type_of ( parent) . kind ( )
751757 {
@@ -760,7 +766,14 @@ pub trait PrettyPrinter<'tcx>:
760766 p ! ( print_def_path( def_id, substs) ) ;
761767 return Ok ( self ) ;
762768 }
763- _ => return self . pretty_print_opaque_impl_type ( def_id, substs) ,
769+ _ => {
770+ if NO_QUERIES . with ( |q| q. get ( ) ) {
771+ p ! ( print_def_path( def_id, & [ ] ) ) ;
772+ return Ok ( self ) ;
773+ } else {
774+ return self . pretty_print_opaque_impl_type ( def_id, substs) ;
775+ }
776+ }
764777 }
765778 }
766779 ty:: Str => p ! ( "str" ) ,
0 commit comments