@@ -711,6 +711,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
711
711
}
712
712
} ;
713
713
714
+ let span = self . tcx . def_span ( expr_def_id) ;
715
+
714
716
let output_ty = match * ret_ty. kind ( ) {
715
717
ty:: Infer ( ty:: TyVar ( ret_vid) ) => {
716
718
self . obligations_for_self_ty ( ret_vid) . find_map ( |obligation| {
@@ -724,20 +726,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
724
726
. find_map ( |( p, s) | get_future_output ( p. as_predicate ( ) , s) ) ?,
725
727
ty:: Error ( _) => return None ,
726
728
_ => span_bug ! (
727
- self . tcx . def_span ( expr_def_id ) ,
729
+ span ,
728
730
"async fn generator return type not an inference variable: {ret_ty}"
729
731
) ,
730
732
} ;
731
733
734
+ let output_ty = self . normalize ( span, output_ty) ;
735
+
732
736
// async fn that have opaque types in their return type need to redo the conversion to inference variables
733
737
// as they fetch the still opaque version from the signature.
734
738
let InferOk { value : output_ty, obligations } = self
735
- . replace_opaque_types_with_inference_vars (
736
- output_ty,
737
- body_def_id,
738
- self . tcx . def_span ( expr_def_id) ,
739
- self . param_env ,
740
- ) ;
739
+ . replace_opaque_types_with_inference_vars ( output_ty, body_def_id, span, self . param_env ) ;
741
740
self . register_predicates ( obligations) ;
742
741
743
742
Some ( output_ty)
0 commit comments