Skip to content

Commit 33cf8fa

Browse files
committed
Sync from rust 03a8cc7
2 parents 2aad006 + d34bcdd commit 33cf8fa

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

src/abi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
117117
.unzip();
118118
let return_layout = self.layout_of(return_ty);
119119
let return_tys = if let ty::Tuple(tup) = return_ty.kind() {
120-
tup.types().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
120+
tup.iter().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
121121
} else {
122122
vec![AbiParam::new(self.clif_type(return_ty).unwrap())]
123123
};
@@ -199,7 +199,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
199199
};
200200

201201
let mut params = Vec::new();
202-
for (i, _arg_ty) in tupled_arg_tys.types().enumerate() {
202+
for (i, _arg_ty) in tupled_arg_tys.iter().enumerate() {
203203
let arg_abi = arg_abis_iter.next().unwrap();
204204
let param =
205205
cvalue_for_param(fx, Some(local), Some(i), arg_abi, &mut block_params_iter);

src/common.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ fn clif_pair_type_from_ty<'tcx>(
9090
ty: Ty<'tcx>,
9191
) -> Option<(types::Type, types::Type)> {
9292
Some(match ty.kind() {
93-
ty::Tuple(substs) if substs.len() == 2 => {
94-
let mut types = substs.types();
95-
let a = clif_type_from_ty(tcx, types.next().unwrap())?;
96-
let b = clif_type_from_ty(tcx, types.next().unwrap())?;
93+
ty::Tuple(types) if types.len() == 2 => {
94+
let a = clif_type_from_ty(tcx, types[0])?;
95+
let b = clif_type_from_ty(tcx, types[1])?;
9796
if a.is_vector() || b.is_vector() {
9897
return None;
9998
}

src/intrinsics/mod.rs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -654,29 +654,35 @@ fn codegen_regular_intrinsic_call<'tcx>(
654654
assert_inhabited | assert_zero_valid | assert_uninit_valid, () {
655655
let layout = fx.layout_of(substs.type_at(0));
656656
if layout.abi.is_uninhabited() {
657-
with_no_trimmed_paths(|| crate::base::codegen_panic(
658-
fx,
659-
&format!("attempted to instantiate uninhabited type `{}`", layout.ty),
660-
span,
661-
));
657+
with_no_trimmed_paths!({
658+
crate::base::codegen_panic(
659+
fx,
660+
&format!("attempted to instantiate uninhabited type `{}`", layout.ty),
661+
span,
662+
)
663+
});
662664
return;
663665
}
664666

665667
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
666-
with_no_trimmed_paths(|| crate::base::codegen_panic(
667-
fx,
668-
&format!("attempted to zero-initialize type `{}`, which is invalid", layout.ty),
669-
span,
670-
));
668+
with_no_trimmed_paths!({
669+
crate::base::codegen_panic(
670+
fx,
671+
&format!("attempted to zero-initialize type `{}`, which is invalid", layout.ty),
672+
span,
673+
);
674+
});
671675
return;
672676
}
673677

674678
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
675-
with_no_trimmed_paths(|| crate::base::codegen_panic(
676-
fx,
677-
&format!("attempted to leave type `{}` uninitialized, which is invalid", layout.ty),
678-
span,
679-
));
679+
with_no_trimmed_paths!({
680+
crate::base::codegen_panic(
681+
fx,
682+
&format!("attempted to leave type `{}` uninitialized, which is invalid", layout.ty),
683+
span,
684+
)
685+
});
680686
return;
681687
}
682688
};

0 commit comments

Comments
 (0)