diff --git a/src/test/ui/print_type_sizes/anonymous.rs b/src/test/ui/print_type_sizes/anonymous.rs index cf0bedee2ab..56c05f566c9 100644 --- a/src/test/ui/print_type_sizes/anonymous.rs +++ b/src/test/ui/print_type_sizes/anonymous.rs @@ -15,7 +15,10 @@ // 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 } diff --git a/src/test/ui/print_type_sizes/generics.rs b/src/test/ui/print_type_sizes/generics.rs index 7bc4822359e..d0e5bd1d92a 100644 --- a/src/test/ui/print_type_sizes/generics.rs +++ b/src/test/ui/print_type_sizes/generics.rs @@ -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(x: T) { Pair::new(FiftyBytes::new(), FiftyBytes::new()); } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _b: Pair = Pair::new(0, 0); let _s: Pair = Pair::new(SevenBytes::new(), SevenBytes::new()); let _z: ZeroSized = ZeroSized; f1::(SevenBytes::new()); + 0 } diff --git a/src/test/ui/print_type_sizes/multiple_types.rs b/src/test/ui/print_type_sizes/multiple_types.rs index a9f29449015..a50b28f3c49 100644 --- a/src/test/ui/print_type_sizes/multiple_types.rs +++ b/src/test/ui/print_type_sizes/multiple_types.rs @@ -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 } diff --git a/src/test/ui/print_type_sizes/niche-filling.rs b/src/test/ui/print_type_sizes/niche-filling.rs index 08b58704022..7f234e243e9 100644 --- a/src/test/ui/print_type_sizes/niche-filling.rs +++ b/src/test/ui/print_type_sizes/niche-filling.rs @@ -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 { Four(D) } -pub fn main() { +#[start] +fn start(_: isize, _: *const *const u8) -> isize { let _x: MyOption> = Default::default(); let _y: EmbeddedDiscr = Default::default(); let _z: MyOption> = 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> = Enum4::One(()); + 0 } diff --git a/src/test/ui/print_type_sizes/no_duplicates.rs b/src/test/ui/print_type_sizes/no_duplicates.rs index 40c41aae910..d9b90260364 100644 --- a/src/test/ui/print_type_sizes/no_duplicates.rs +++ b/src/test/ui/print_type_sizes/no_duplicates.rs @@ -15,12 +15,16 @@ // (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 } diff --git a/src/test/ui/print_type_sizes/packed.rs b/src/test/ui/print_type_sizes/packed.rs index 1ee6395ac6c..a4288f67899 100644 --- a/src/test/ui/print_type_sizes/packed.rs +++ b/src/test/ui/print_type_sizes/packed.rs @@ -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 } diff --git a/src/test/ui/print_type_sizes/padding.rs b/src/test/ui/print_type_sizes/padding.rs index b3cd2132343..b4661efdd27 100644 --- a/src/test/ui/print_type_sizes/padding.rs +++ b/src/test/ui/print_type_sizes/padding.rs @@ -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 +} diff --git a/src/test/ui/print_type_sizes/repr-align.rs b/src/test/ui/print_type_sizes/repr-align.rs index 1bf76da8115..108b8dbba01 100644 --- a/src/test/ui/print_type_sizes/repr-align.rs +++ b/src/test/ui/print_type_sizes/repr-align.rs @@ -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 } diff --git a/src/test/ui/print_type_sizes/uninhabited.rs b/src/test/ui/print_type_sizes/uninhabited.rs index fae6cd4009c..4d0396903e5 100644 --- a/src/test/ui/print_type_sizes/uninhabited.rs +++ b/src/test/ui/print_type_sizes/uninhabited.rs @@ -12,8 +12,11 @@ // 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 = Ok(42); + 0 } diff --git a/src/test/ui/print_type_sizes/variants.rs b/src/test/ui/print_type_sizes/variants.rs index 2725bb09b4b..e4d54162e73 100644 --- a/src/test/ui/print_type_sizes/variants.rs +++ b/src/test/ui/print_type_sizes/variants.rs @@ -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 }