@@ -77,9 +77,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
77
77
let generator_types =
78
78
check_fn ( self , self . param_env , liberated_sig, decl, expr. hir_id , body, gen) . 1 ;
79
79
80
- // Create type variables (for now) to represent the transformed
81
- // types of upvars. These will be unified during the upvar
82
- // inference phase (`upvar.rs`).
83
80
let base_substs =
84
81
InternalSubsts :: identity_for_item ( self . tcx , self . tcx . closure_base_def_id ( expr_def_id) ) ;
85
82
// HACK(eddyb) this hardcodes indices into substs but it should rely on
@@ -93,6 +90,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
93
90
GenericParamDefKind :: Type { .. } => if param. index as usize == tupled_upvars_idx {
94
91
self . tcx . mk_tup ( self . tcx . upvars ( expr_def_id) . iter ( ) . flat_map ( |upvars| {
95
92
upvars. iter ( ) . map ( |( & var_hir_id, _) | {
93
+ // Create type variables (for now) to represent the transformed
94
+ // types of upvars. These will be unified during the upvar
95
+ // inference phase (`upvar.rs`).
96
96
self . infcx . next_ty_var ( TypeVariableOrigin {
97
97
// FIXME(eddyb) distinguish upvar inference variables from the rest.
98
98
kind : TypeVariableOriginKind :: ClosureSynthetic ,
@@ -101,6 +101,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
101
101
} )
102
102
} ) )
103
103
} else {
104
+ // Create type variables (for now) to represent the various
105
+ // pieces of information kept in `{Closure,Generic}Substs`.
106
+ // They will either be unified below, or later during the upvar
107
+ // inference phase (`upvar.rs`)
104
108
self . infcx . next_ty_var ( TypeVariableOrigin {
105
109
kind : TypeVariableOriginKind :: ClosureSynthetic ,
106
110
span : expr. span ,
0 commit comments