use List<Ty<'tcx>> for tuples

This commit is contained in:
lcnr
2022-02-07 16:06:31 +01:00
parent a9c1ab82f5
commit 1245131a11
53 changed files with 128 additions and 170 deletions

View File

@@ -843,12 +843,10 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
// FIXME: enable the general case stated above ^.
let ty = value.layout.ty;
// Only do it for tuples
if let ty::Tuple(substs) = ty.kind() {
if let ty::Tuple(types) = ty.kind() {
// Only do it if tuple is also a pair with two scalars
if substs.len() == 2 {
if let [ty1, ty2] = types[..] {
let alloc = self.use_ecx(|this| {
let ty1 = substs[0].expect_ty();
let ty2 = substs[1].expect_ty();
let ty_is_scalar = |ty| {
this.ecx.layout_of(ty).ok().map(|layout| layout.abi.is_scalar())
== Some(true)