@@ -15,8 +15,6 @@ use rustc_middle::ty::{self, TyCtxt};
15
15
use rustc_span:: symbol:: { kw, sym, Symbol } ;
16
16
use rustc_target:: spec:: abi:: Abi ;
17
17
18
- use std:: iter;
19
-
20
18
fn equate_intrinsic_type < ' tcx > (
21
19
tcx : TyCtxt < ' tcx > ,
22
20
it : & hir:: ForeignItem < ' _ > ,
@@ -139,14 +137,10 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
139
137
let intrinsic_name = tcx. item_name ( intrinsic_id) ;
140
138
let name_str = intrinsic_name. as_str ( ) ;
141
139
142
- let bound_vars = tcx. mk_bound_variable_kinds (
143
- [
144
- ty:: BoundVariableKind :: Region ( ty:: BrAnon ( 0 , None ) ) ,
145
- ty:: BoundVariableKind :: Region ( ty:: BrEnv ) ,
146
- ]
147
- . iter ( )
148
- . copied ( ) ,
149
- ) ;
140
+ let bound_vars = tcx. intern_bound_variable_kinds ( & [
141
+ ty:: BoundVariableKind :: Region ( ty:: BrAnon ( 0 , None ) ) ,
142
+ ty:: BoundVariableKind :: Region ( ty:: BrEnv ) ,
143
+ ] ) ;
150
144
let mk_va_list_ty = |mutbl| {
151
145
tcx. lang_items ( ) . va_list ( ) . map ( |did| {
152
146
let region = tcx. mk_re_late_bound (
@@ -378,21 +372,21 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
378
372
(
379
373
1 ,
380
374
vec ! [ tcx. mk_imm_ref( tcx. mk_re_late_bound( ty:: INNERMOST , br) , param( 0 ) ) ] ,
381
- tcx. mk_projection ( discriminant_def_id, tcx. mk_substs ( [ param ( 0 ) . into ( ) ] . iter ( ) ) ) ,
375
+ tcx. mk_projection ( discriminant_def_id, tcx. intern_substs ( & [ param ( 0 ) . into ( ) ] ) ) ,
382
376
)
383
377
}
384
378
385
379
kw:: Try => {
386
380
let mut_u8 = tcx. mk_mut_ptr ( tcx. types . u8 ) ;
387
381
let try_fn_ty = ty:: Binder :: dummy ( tcx. mk_fn_sig (
388
- iter :: once ( mut_u8) ,
382
+ [ mut_u8] ,
389
383
tcx. mk_unit ( ) ,
390
384
false ,
391
385
hir:: Unsafety :: Normal ,
392
386
Abi :: Rust ,
393
387
) ) ;
394
388
let catch_fn_ty = ty:: Binder :: dummy ( tcx. mk_fn_sig (
395
- [ mut_u8, mut_u8] . iter ( ) . cloned ( ) ,
389
+ [ mut_u8, mut_u8] ,
396
390
tcx. mk_unit ( ) ,
397
391
false ,
398
392
hir:: Unsafety :: Normal ,
@@ -447,7 +441,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
447
441
} ;
448
442
( n_tps, 0 , inputs, output, unsafety)
449
443
} ;
450
- let sig = tcx. mk_fn_sig ( inputs. into_iter ( ) , output, false , unsafety, Abi :: RustIntrinsic ) ;
444
+ let sig = tcx. mk_fn_sig ( inputs, output, false , unsafety, Abi :: RustIntrinsic ) ;
451
445
let sig = ty:: Binder :: bind_with_vars ( sig, bound_vars) ;
452
446
equate_intrinsic_type ( tcx, it, n_tps, n_lts, sig)
453
447
}
@@ -545,13 +539,7 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>)
545
539
}
546
540
} ;
547
541
548
- let sig = tcx. mk_fn_sig (
549
- inputs. into_iter ( ) ,
550
- output,
551
- false ,
552
- hir:: Unsafety :: Unsafe ,
553
- Abi :: PlatformIntrinsic ,
554
- ) ;
542
+ let sig = tcx. mk_fn_sig ( inputs, output, false , hir:: Unsafety :: Unsafe , Abi :: PlatformIntrinsic ) ;
555
543
let sig = ty:: Binder :: dummy ( sig) ;
556
544
equate_intrinsic_type ( tcx, it, n_tps, 0 , sig)
557
545
}
0 commit comments