]> git.lizzy.rs Git - rust.git/commitdiff
Treat `struct(T)` the same as `struct S { x: T }` WRT being immediate args
authorBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 9 Jan 2015 16:40:13 +0000 (17:40 +0100)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Fri, 9 Jan 2015 16:40:13 +0000 (17:40 +0100)
Currently we pass a `struct S(u64)` as an immediate value on i686, but a
`struct S { x: u64 }` is passed indirectly. This seems pretty wrong,
as they both have the same underlying LLVM type `{ i64 }`, no sense in
treating them differently.

src/librustc_trans/trans/common.rs

index 3afd33d324dd1867417772cadaf49d83931a9b29..fb58d935922313443973f4a4140286f4412c20a7 100644 (file)
@@ -222,10 +222,7 @@ fn type_is_newtype_immediate<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
     match ty.sty {
         ty::ty_struct(def_id, substs) => {
             let fields = ty::struct_fields(ccx.tcx(), def_id, substs);
-            fields.len() == 1 &&
-                fields[0].name ==
-                    token::special_idents::unnamed_field.name &&
-                type_is_immediate(ccx, fields[0].mt.ty)
+            fields.len() == 1 && type_is_immediate(ccx, fields[0].mt.ty)
         }
         _ => false
     }