Sync from rust 03a8cc7df1d65554a4d40825b0490c93ac0f0236
This commit is contained in:
commit
33cf8fafd8
@ -117,7 +117,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
|
||||
.unzip();
|
||||
let return_layout = self.layout_of(return_ty);
|
||||
let return_tys = if let ty::Tuple(tup) = return_ty.kind() {
|
||||
tup.types().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
|
||||
tup.iter().map(|ty| AbiParam::new(self.clif_type(ty).unwrap())).collect()
|
||||
} else {
|
||||
vec![AbiParam::new(self.clif_type(return_ty).unwrap())]
|
||||
};
|
||||
@ -199,7 +199,7 @@ pub(crate) fn codegen_fn_prelude<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, start_
|
||||
};
|
||||
|
||||
let mut params = Vec::new();
|
||||
for (i, _arg_ty) in tupled_arg_tys.types().enumerate() {
|
||||
for (i, _arg_ty) in tupled_arg_tys.iter().enumerate() {
|
||||
let arg_abi = arg_abis_iter.next().unwrap();
|
||||
let param =
|
||||
cvalue_for_param(fx, Some(local), Some(i), arg_abi, &mut block_params_iter);
|
||||
|
@ -90,10 +90,9 @@ fn clif_pair_type_from_ty<'tcx>(
|
||||
ty: Ty<'tcx>,
|
||||
) -> Option<(types::Type, types::Type)> {
|
||||
Some(match ty.kind() {
|
||||
ty::Tuple(substs) if substs.len() == 2 => {
|
||||
let mut types = substs.types();
|
||||
let a = clif_type_from_ty(tcx, types.next().unwrap())?;
|
||||
let b = clif_type_from_ty(tcx, types.next().unwrap())?;
|
||||
ty::Tuple(types) if types.len() == 2 => {
|
||||
let a = clif_type_from_ty(tcx, types[0])?;
|
||||
let b = clif_type_from_ty(tcx, types[1])?;
|
||||
if a.is_vector() || b.is_vector() {
|
||||
return None;
|
||||
}
|
||||
|
@ -654,29 +654,35 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
assert_inhabited | assert_zero_valid | assert_uninit_valid, () {
|
||||
let layout = fx.layout_of(substs.type_at(0));
|
||||
if layout.abi.is_uninhabited() {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to instantiate uninhabited type `{}`", layout.ty),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to instantiate uninhabited type `{}`", layout.ty),
|
||||
span,
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to zero-initialize type `{}`, which is invalid", layout.ty),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to zero-initialize type `{}`, which is invalid", layout.ty),
|
||||
span,
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to leave type `{}` uninitialized, which is invalid", layout.ty),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to leave type `{}` uninitialized, which is invalid", layout.ty),
|
||||
span,
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user