@@ -272,7 +272,7 @@ impl<'tcx> GotocCtx<'tcx> {
272
272
let env = prev_args[ 0 ] ;
273
273
274
274
// Recombine arguments: environment first, then the flattened tuple elements
275
- let recombined_args = iter:: once ( env) . chain ( args) ;
275
+ let recombined_args: Vec < _ > = iter:: once ( env) . chain ( args) . collect ( ) ;
276
276
277
277
return ty:: Binder :: bind_with_vars (
278
278
self . tcx . mk_fn_sig (
@@ -297,7 +297,7 @@ impl<'tcx> GotocCtx<'tcx> {
297
297
298
298
// In addition to `def_id` and `substs`, we need to provide the kind of region `env_region`
299
299
// in `closure_env_ty`, which we can build from the bound variables as follows
300
- let bound_vars = self . tcx . mk_bound_variable_kinds (
300
+ let bound_vars = self . tcx . mk_bound_variable_kinds_from_iter (
301
301
sig. bound_vars ( ) . iter ( ) . chain ( iter:: once ( ty:: BoundVariableKind :: Region ( ty:: BrEnv ) ) ) ,
302
302
) ;
303
303
let br = ty:: BoundRegion {
@@ -314,7 +314,7 @@ impl<'tcx> GotocCtx<'tcx> {
314
314
// * the rest of attributes are obtained from `sig`
315
315
let sig = ty:: Binder :: bind_with_vars (
316
316
self . tcx . mk_fn_sig (
317
- iter :: once ( env_ty) . chain ( iter :: once ( sig. inputs ( ) [ 0 ] ) ) ,
317
+ [ env_ty, sig. inputs ( ) [ 0 ] ] ,
318
318
sig. output ( ) ,
319
319
sig. c_variadic ,
320
320
sig. unsafety ,
@@ -338,19 +338,19 @@ impl<'tcx> GotocCtx<'tcx> {
338
338
) -> ty:: PolyFnSig < ' tcx > {
339
339
let sig = substs. as_generator ( ) . poly_sig ( ) ;
340
340
341
- let bound_vars = self . tcx . mk_bound_variable_kinds (
341
+ let bound_vars = self . tcx . mk_bound_variable_kinds_from_iter (
342
342
sig. bound_vars ( ) . iter ( ) . chain ( iter:: once ( ty:: BoundVariableKind :: Region ( ty:: BrEnv ) ) ) ,
343
343
) ;
344
344
let br = ty:: BoundRegion {
345
345
var : ty:: BoundVar :: from_usize ( bound_vars. len ( ) - 1 ) ,
346
346
kind : ty:: BoundRegionKind :: BrEnv ,
347
347
} ;
348
348
let env_region = ty:: ReLateBound ( ty:: INNERMOST , br) ;
349
- let env_ty = self . tcx . mk_mut_ref ( self . tcx . mk_region ( env_region) , ty) ;
349
+ let env_ty = self . tcx . mk_mut_ref ( self . tcx . mk_region_from_kind ( env_region) , ty) ;
350
350
351
351
let pin_did = self . tcx . require_lang_item ( LangItem :: Pin , None ) ;
352
352
let pin_adt_ref = self . tcx . adt_def ( pin_did) ;
353
- let pin_substs = self . tcx . intern_substs ( & [ env_ty. into ( ) ] ) ;
353
+ let pin_substs = self . tcx . mk_substs ( & [ env_ty. into ( ) ] ) ;
354
354
let env_ty = self . tcx . mk_adt ( pin_adt_ref, pin_substs) ;
355
355
356
356
let sig = sig. skip_binder ( ) ;
@@ -363,7 +363,7 @@ impl<'tcx> GotocCtx<'tcx> {
363
363
// The signature should be `Future::poll(_, &mut Context<'_>) -> Poll<Output>`
364
364
let poll_did = tcx. require_lang_item ( LangItem :: Poll , None ) ;
365
365
let poll_adt_ref = tcx. adt_def ( poll_did) ;
366
- let poll_substs = tcx. intern_substs ( & [ sig. return_ty . into ( ) ] ) ;
366
+ let poll_substs = tcx. mk_substs ( & [ sig. return_ty . into ( ) ] ) ;
367
367
let ret_ty = tcx. mk_adt ( poll_adt_ref, poll_substs) ;
368
368
369
369
// We have to replace the `ResumeTy` that is used for type and borrow checking
@@ -384,16 +384,16 @@ impl<'tcx> GotocCtx<'tcx> {
384
384
// The signature should be `Generator::resume(_, Resume) -> GeneratorState<Yield, Return>`
385
385
let state_did = tcx. require_lang_item ( LangItem :: GeneratorState , None ) ;
386
386
let state_adt_ref = tcx. adt_def ( state_did) ;
387
- let state_substs = tcx. intern_substs ( & [ sig. yield_ty . into ( ) , sig. return_ty . into ( ) ] ) ;
387
+ let state_substs = tcx. mk_substs ( & [ sig. yield_ty . into ( ) , sig. return_ty . into ( ) ] ) ;
388
388
let ret_ty = tcx. mk_adt ( state_adt_ref, state_substs) ;
389
389
390
390
( sig. resume_ty , ret_ty)
391
391
} ;
392
392
393
393
ty:: Binder :: bind_with_vars (
394
394
tcx. mk_fn_sig (
395
- [ env_ty, resume_ty] . iter ( ) ,
396
- & ret_ty,
395
+ [ env_ty, resume_ty] ,
396
+ ret_ty,
397
397
false ,
398
398
Unsafety :: Normal ,
399
399
rustc_target:: spec:: abi:: Abi :: Rust ,
@@ -423,7 +423,7 @@ impl<'tcx> GotocCtx<'tcx> {
423
423
impl < ' tcx > GotocCtx < ' tcx > {
424
424
pub fn monomorphize < T > ( & self , value : T ) -> T
425
425
where
426
- T : TypeFoldable < ' tcx > ,
426
+ T : TypeFoldable < TyCtxt < ' tcx > > ,
427
427
{
428
428
// Instance is Some(..) only when current codegen unit is a function.
429
429
if let Some ( current_fn) = & self . current_fn {
0 commit comments