@@ -19,7 +19,7 @@ use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
19
19
use rustc:: middle:: lang_items;
20
20
use rustc:: ty:: fold:: TypeFoldable ;
21
21
use rustc:: ty:: subst:: { InternalSubsts , SubstsRef , Subst } ;
22
- use rustc:: ty:: { self , GeneratorSubsts , RegionVid , Ty , TyCtxt } ;
22
+ use rustc:: ty:: { self , RegionVid , Ty , TyCtxt } ;
23
23
use rustc:: util:: nodemap:: FxHashMap ;
24
24
use rustc_index:: vec:: { Idx , IndexVec } ;
25
25
use rustc_errors:: DiagnosticBuilder ;
@@ -90,7 +90,7 @@ pub enum DefiningTy<'tcx> {
90
90
/// The MIR is a generator. The signature is that generators take
91
91
/// no parameters and return the result of
92
92
/// `ClosureSubsts::generator_return_ty`.
93
- Generator ( DefId , ty :: GeneratorSubsts < ' tcx > , hir:: GeneratorMovability ) ,
93
+ Generator ( DefId , SubstsRef < ' tcx > , hir:: GeneratorMovability ) ,
94
94
95
95
/// The MIR is a fn item with the given `DefId` and substs. The signature
96
96
/// of the function can be bound then with the `fn_sig` query.
@@ -113,7 +113,7 @@ impl<'tcx> DefiningTy<'tcx> {
113
113
substs. as_closure ( ) . upvar_tys ( def_id, tcx)
114
114
) ,
115
115
DefiningTy :: Generator ( def_id, substs, _) => {
116
- Either :: Right ( Either :: Left ( substs. upvar_tys ( def_id, tcx) ) )
116
+ Either :: Right ( Either :: Left ( substs. as_generator ( ) . upvar_tys ( def_id, tcx) ) )
117
117
}
118
118
DefiningTy :: FnDef ( ..) | DefiningTy :: Const ( ..) => {
119
119
Either :: Right ( Either :: Right ( iter:: empty ( ) ) )
@@ -334,7 +334,7 @@ impl<'tcx> UniversalRegions<'tcx> {
334
334
err. note ( & format ! (
335
335
"defining type: {:?} with generator substs {:#?}" ,
336
336
def_id,
337
- & substs. substs [ ..]
337
+ & substs[ ..]
338
338
) ) ;
339
339
340
340
// FIXME: As above, we'd like to print out the region
@@ -470,7 +470,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
470
470
471
471
let yield_ty = match defining_ty {
472
472
DefiningTy :: Generator ( def_id, substs, _) => {
473
- Some ( substs. yield_ty ( def_id, self . infcx . tcx ) )
473
+ Some ( substs. as_generator ( ) . yield_ty ( def_id, self . infcx . tcx ) )
474
474
}
475
475
_ => None ,
476
476
} ;
@@ -549,7 +549,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
549
549
let identity_substs = InternalSubsts :: identity_for_item ( tcx, closure_base_def_id) ;
550
550
let fr_substs = match defining_ty {
551
551
DefiningTy :: Closure ( _, ref substs)
552
- | DefiningTy :: Generator ( _, GeneratorSubsts { ref substs } , _) => {
552
+ | DefiningTy :: Generator ( _, ref substs, _) => {
553
553
// In the case of closures, we rely on the fact that
554
554
// the first N elements in the ClosureSubsts are
555
555
// inherited from the `closure_base_def_id`.
@@ -612,7 +612,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
612
612
613
613
DefiningTy :: Generator ( def_id, substs, movability) => {
614
614
assert_eq ! ( self . mir_def_id, def_id) ;
615
- let output = substs. return_ty ( def_id, tcx) ;
615
+ let output = substs. as_generator ( ) . return_ty ( def_id, tcx) ;
616
616
let generator_ty = tcx. mk_generator ( def_id, substs, movability) ;
617
617
let inputs_and_output = self . infcx . tcx . intern_type_list ( & [ generator_ty, output] ) ;
618
618
ty:: Binder :: dummy ( inputs_and_output)
0 commit comments