@@ -999,6 +999,19 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
999
999
OpaqueTypeDecl { opaque_type : ty, definition_span, concrete_ty : ty_var, origin } ,
1000
1000
) ;
1001
1001
debug ! ( "instantiate_opaque_types: ty_var={:?}" , ty_var) ;
1002
+ self . compute_opaque_type_obligations ( opaque_type_key, span) ;
1003
+
1004
+ ty_var
1005
+ }
1006
+
1007
+ fn compute_opaque_type_obligations (
1008
+ & mut self ,
1009
+ opaque_type_key : OpaqueTypeKey < ' tcx > ,
1010
+ span : Span ,
1011
+ ) {
1012
+ let infcx = self . infcx ;
1013
+ let tcx = infcx. tcx ;
1014
+ let OpaqueTypeKey { def_id, substs } = opaque_type_key;
1002
1015
1003
1016
let item_bounds = tcx. explicit_item_bounds ( def_id) ;
1004
1017
debug ! ( "instantiate_opaque_types: bounds={:#?}" , item_bounds) ;
@@ -1019,7 +1032,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
1019
1032
if let ty:: PredicateKind :: Projection ( projection) = predicate. kind ( ) . skip_binder ( ) {
1020
1033
if projection. ty . references_error ( ) {
1021
1034
// No point on adding these obligations since there's a type error involved.
1022
- return ty_var ;
1035
+ return ;
1023
1036
}
1024
1037
}
1025
1038
}
@@ -1037,8 +1050,6 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
1037
1050
debug ! ( "instantiate_opaque_types: predicate={:?}" , predicate) ;
1038
1051
self . obligations . push ( traits:: Obligation :: new ( cause, self . param_env , predicate) ) ;
1039
1052
}
1040
-
1041
- ty_var
1042
1053
}
1043
1054
}
1044
1055
0 commit comments