]> git.lizzy.rs Git - rust.git/commitdiff
convert print-type-sizes to use `start` instead of `main`
authorNiko Matsakis <niko@alum.mit.edu>
Tue, 5 Dec 2017 10:03:59 +0000 (05:03 -0500)
committerBastian Köcher <git@kchr.de>
Tue, 26 Dec 2017 11:26:39 +0000 (12:26 +0100)
This avoids bringing in unwind machinery.

src/test/ui/print_type_sizes/anonymous.rs
src/test/ui/print_type_sizes/generics.rs
src/test/ui/print_type_sizes/multiple_types.rs
src/test/ui/print_type_sizes/niche-filling.rs
src/test/ui/print_type_sizes/no_duplicates.rs
src/test/ui/print_type_sizes/packed.rs
src/test/ui/print_type_sizes/padding.rs
src/test/ui/print_type_sizes/repr-align.rs
src/test/ui/print_type_sizes/uninhabited.rs
src/test/ui/print_type_sizes/variants.rs

index cf0bedee2ab3ea7b32a9463135294293ea44aae7..56c05f566c9abc4ddd117ce1bedc29f0d2447008 100644 (file)
 // that one cannot control the sizes of these types with the same sort
 // of enum-variant manipulation tricks.
 
-pub fn main() {
+#![feature(start)]
+
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _byte: u8 = 0;
     let _word: usize = 0;
     let _tuple: (u8, usize)= (0, 0);
@@ -25,4 +28,6 @@ pub fn main() {
 
     fn id(x: u8) -> u8 { x };
     fn bye(_: u8) -> ! { loop { } }
+
+    0
 }
index 7bc4822359e2a8182e6715999cdd2effbf41b238..d0e5bd1d92abfd07dd9c2d9b860ae781035c0200 100644 (file)
@@ -15,6 +15,8 @@
 // monomorphized, in the MIR of the original function in which they
 // occur, to have their size reported.
 
+#![feature(start)]
+
 // In an ad-hoc attempt to avoid the injection of unwinding code
 // (which clutters the output of `-Z print-type-sizes` with types from
 // `unwind::libunwind`):
@@ -66,9 +68,11 @@ pub fn f1<T:Copy>(x: T) {
         Pair::new(FiftyBytes::new(), FiftyBytes::new());
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _b: Pair<u8> = Pair::new(0, 0);
     let _s: Pair<SevenBytes> = Pair::new(SevenBytes::new(), SevenBytes::new());
     let _z: ZeroSized = ZeroSized;
     f1::<SevenBytes>(SevenBytes::new());
+    0
 }
index a9f294490159d842b465ae0b242977efa14877b1..a50b28f3c4952ffaad472a7e28c2139a9716a1d2 100644 (file)
@@ -14,6 +14,8 @@
 // This file illustrates that when multiple structural types occur in
 // a function, every one of them is included in the output.
 
+#![feature(start)]
+
 pub struct SevenBytes([u8;  7]);
 pub struct FiftyBytes([u8; 50]);
 
@@ -22,8 +24,10 @@ pub enum Enum {
     Large(FiftyBytes),
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _e: Enum;
     let _f: FiftyBytes;
     let _s: SevenBytes;
+    0
 }
index 08b58704022ec299e44d321d71bc3551c72657a3..7f234e243e9265b00dbe1059e6b45193d4d34276 100644 (file)
@@ -21,6 +21,7 @@
 // aligned (while on most it is 8-byte aligned) and so the resulting
 // padding and overall computed sizes can be quite different.
 
+#![feature(start)]
 #![feature(nonzero)]
 #![allow(dead_code)]
 
@@ -76,7 +77,8 @@ pub enum Enum4<A, B, C, D> {
     Four(D)
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _x: MyOption<NonZero<u32>> = Default::default();
     let _y: EmbeddedDiscr = Default::default();
     let _z: MyOption<IndirectNonZero<u32>> = Default::default();
@@ -87,4 +89,5 @@ pub fn main() {
     let _e: Enum4<(), char, (), ()> = Enum4::One(());
     let _f: Enum4<(), (), bool, ()> = Enum4::One(());
     let _g: Enum4<(), (), (), MyOption<u8>> = Enum4::One(());
+    0
 }
index 40c41aae9109d9238d5097154d36e652eea6ede6..d9b90260364b2aa270f9c4023270c2ad1fcab2e3 100644 (file)
 // (even if multiple functions), it is only printed once in the
 // print-type-sizes output.
 
+#![feature(start)]
+
 pub struct SevenBytes([u8; 7]);
 
 pub fn f1() {
     let _s: SevenBytes = SevenBytes([0; 7]);
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _s: SevenBytes = SevenBytes([0; 7]);
+    0
 }
index 1ee6395ac6cba711849fab6b31b3244f0487a715..a4288f67899a2289bea39489d77b409fcba7389a 100644 (file)
@@ -20,6 +20,7 @@
 // padding and overall computed sizes can be quite different.
 
 #![allow(dead_code)]
+#![feature(start)]
 
 #[derive(Default)]
 #[repr(packed)]
@@ -42,7 +43,9 @@ struct Padded {
     d: u8,
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _c: Packed = Default::default();
     let _d: Padded = Default::default();
+    0
 }
index b3cd21323430546410007e6fb8828753fa0d4213..b4661efdd27a249739394f55ca28fc5fc158a700 100644 (file)
@@ -19,6 +19,7 @@
 // aligned (while on most it is 8-byte aligned) and so the resulting
 // padding and overall computed sizes can be quite different.
 
+#![feature(start)]
 #![allow(dead_code)]
 
 struct S {
@@ -37,4 +38,7 @@ enum E2 {
     B(S),
 }
 
-fn main() { }
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
+    0
+}
index 1bf76da811552873edff540667e1d548c5a47a84..108b8dbba0198f10905ff645436a046d635dda9d 100644 (file)
@@ -20,6 +20,7 @@
 // padding and overall computed sizes can be quite different.
 #![feature(attr_literals)]
 #![feature(repr_align)]
+#![feature(start)]
 #![allow(dead_code)]
 
 #[repr(align(16))]
@@ -39,6 +40,8 @@ struct S {
     d: i8,
 }
 
-fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _s: S = Default::default();
+    0
 }
index fae6cd4009c309d8c226d6d63b84f6f29fa0fc93..4d0396903e555d507861c3de9fc6e9a77b2cd56a 100644 (file)
 // must-compile-successfully
 
 #![feature(never_type)]
+#![feature(start)]
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _x: Option<!> = None;
     let _y: Result<u32, !> = Ok(42);
+    0
 }
index 2725bb09b4bc0c89ad2b6e008529b75fc4d0e634..e4d54162e73af5bcb93e31775259ff9d990f948d 100644 (file)
@@ -19,6 +19,8 @@
 // 2. For an enum, the print-type-sizes output will also include the
 //    size of each variant.
 
+#![feature(start)]
+
 pub struct SevenBytes([u8;  7]);
 pub struct FiftyBytes([u8; 50]);
 
@@ -27,6 +29,8 @@ pub enum Enum {
     Large(FiftyBytes),
 }
 
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
     let _e: Enum;
+    0
 }