@@ -863,7 +863,6 @@ struct Instantiator<'a, 'tcx> {
863
863
}
864
864
865
865
impl < ' a , ' tcx > Instantiator < ' a , ' tcx > {
866
- #[ instrument( level = "debug" , skip( self ) ) ]
867
866
fn instantiate_opaque_types_in_map < T : TypeFoldable < ' tcx > > ( & mut self , value : T ) -> T {
868
867
let tcx = self . infcx . tcx ;
869
868
value. fold_with ( & mut BottomUpFolder {
@@ -954,35 +953,28 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
954
953
} )
955
954
}
956
955
956
+ #[ instrument( skip( self ) , level = "debug" ) ]
957
957
fn fold_opaque_ty (
958
958
& mut self ,
959
959
ty : Ty < ' tcx > ,
960
960
opaque_type_key : OpaqueTypeKey < ' tcx > ,
961
961
origin : hir:: OpaqueTyOrigin ,
962
962
) -> Ty < ' tcx > {
963
963
let infcx = self . infcx ;
964
- let tcx = infcx. tcx ;
965
964
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
966
965
967
- debug ! ( "instantiate_opaque_types: Opaque(def_id={:?}, substs={:?})" , def_id, substs) ;
968
-
969
966
// Use the same type variable if the exact same opaque type appears more
970
967
// than once in the return type (e.g., if it's passed to a type alias).
971
968
if let Some ( opaque_defn) = infcx. inner . borrow ( ) . opaque_types . get ( & opaque_type_key) {
972
- debug ! ( "instantiate_opaque_types: returning concrete ty {:?}" , opaque_defn. concrete_ty) ;
969
+ debug ! ( "re-using cached concrete type {:?}" , opaque_defn. concrete_ty. kind ( ) ) ;
973
970
return opaque_defn. concrete_ty ;
974
971
}
972
+
975
973
let ty_var = infcx. next_ty_var ( TypeVariableOrigin {
976
974
kind : TypeVariableOriginKind :: TypeInference ,
977
975
span : self . value_span ,
978
976
} ) ;
979
977
980
- // Make sure that we are in fact defining the *entire* type
981
- // (e.g., `type Foo<T: Bound> = impl Bar;` needs to be
982
- // defined by a function like `fn foo<T: Bound>() -> Foo<T>`).
983
- debug ! ( "instantiate_opaque_types: param_env={:#?}" , self . param_env, ) ;
984
- debug ! ( "instantiate_opaque_types: generics={:#?}" , tcx. generics_of( def_id) , ) ;
985
-
986
978
// Ideally, we'd get the span where *this specific `ty` came
987
979
// from*, but right now we just use the span from the overall
988
980
// value being folded. In simple cases like `-> impl Foo`,
@@ -999,7 +991,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
999
991
infcx. opaque_types_vars . insert ( ty_var, ty) ;
1000
992
}
1001
993
1002
- debug ! ( "instantiate_opaque_types: ty_var= {:?}" , ty_var) ;
994
+ debug ! ( "generated new type inference var {:?}" , ty_var. kind ( ) ) ;
1003
995
self . compute_opaque_type_obligations ( opaque_type_key) ;
1004
996
1005
997
ty_var
@@ -1011,7 +1003,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
1011
1003
let OpaqueTypeKey { def_id, substs } = opaque_type_key;
1012
1004
1013
1005
let item_bounds = tcx. explicit_item_bounds ( def_id) ;
1014
- debug ! ( "instantiate_opaque_types: bounds={:#?}" , item_bounds) ;
1006
+ debug ! ( ? item_bounds) ;
1015
1007
let bounds: Vec < _ > =
1016
1008
item_bounds. iter ( ) . map ( |( bound, _) | bound. subst ( tcx, substs) ) . collect ( ) ;
1017
1009
@@ -1023,7 +1015,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
1023
1015
) ;
1024
1016
self . obligations . extend ( obligations) ;
1025
1017
1026
- debug ! ( "instantiate_opaque_types: bounds={:?}" , bounds) ;
1018
+ debug ! ( ? bounds) ;
1027
1019
1028
1020
for predicate in & bounds {
1029
1021
if let ty:: PredicateKind :: Projection ( projection) = predicate. kind ( ) . skip_binder ( ) {
0 commit comments