@@ -1036,9 +1036,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
1036
1036
let mut fcx = FnCtxt :: new ( inherited, param_env, body. value . id ) ;
1037
1037
* fcx. ps . borrow_mut ( ) = UnsafetyState :: function ( fn_sig. unsafety , fn_id) ;
1038
1038
1039
- let ret_ty = fn_sig. output ( ) ;
1040
- fcx. require_type_is_sized ( ret_ty , decl. output . span ( ) , traits:: SizedReturnType ) ;
1041
- let revealed_ret_ty = fcx. instantiate_anon_types_from_return_value ( fn_id, & ret_ty ) ;
1039
+ let declared_ret_ty = fn_sig. output ( ) ;
1040
+ fcx. require_type_is_sized ( declared_ret_ty , decl. output . span ( ) , traits:: SizedReturnType ) ;
1041
+ let revealed_ret_ty = fcx. instantiate_anon_types_from_return_value ( fn_id, & declared_ret_ty ) ;
1042
1042
fcx. ret_coercion = Some ( RefCell :: new ( CoerceMany :: new ( revealed_ret_ty) ) ) ;
1043
1043
fn_sig = fcx. tcx . mk_fn_sig (
1044
1044
fn_sig. inputs ( ) . iter ( ) . cloned ( ) ,
@@ -1132,7 +1132,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
1132
1132
if id == fn_id {
1133
1133
match entry_type {
1134
1134
config:: EntryMain => {
1135
- let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( ret_ty ) ) ) ;
1135
+ let substs = fcx. tcx . mk_substs ( iter:: once ( Kind :: from ( declared_ret_ty ) ) ) ;
1136
1136
let trait_ref = ty:: TraitRef :: new ( term_id, substs) ;
1137
1137
let return_ty_span = decl. output . span ( ) ;
1138
1138
let cause = traits:: ObligationCause :: new (
0 commit comments