This avoids bringing in unwind machinery.
// 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);
fn id(x: u8) -> u8 { x };
fn bye(_: u8) -> ! { loop { } }
+
+ 0
}
// 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`):
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
}
// 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]);
Large(FiftyBytes),
}
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
let _e: Enum;
let _f: FiftyBytes;
let _s: SevenBytes;
+ 0
}
// 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)]
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();
let _e: Enum4<(), char, (), ()> = Enum4::One(());
let _f: Enum4<(), (), bool, ()> = Enum4::One(());
let _g: Enum4<(), (), (), MyOption<u8>> = Enum4::One(());
+ 0
}
// (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
}
// padding and overall computed sizes can be quite different.
#![allow(dead_code)]
+#![feature(start)]
#[derive(Default)]
#[repr(packed)]
d: u8,
}
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
let _c: Packed = Default::default();
let _d: Padded = Default::default();
+ 0
}
// 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 {
B(S),
}
-fn main() { }
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
+ 0
+}
// padding and overall computed sizes can be quite different.
#![feature(attr_literals)]
#![feature(repr_align)]
+#![feature(start)]
#![allow(dead_code)]
#[repr(align(16))]
d: i8,
}
-fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
let _s: S = Default::default();
+ 0
}
// 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
}
// 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]);
Large(FiftyBytes),
}
-pub fn main() {
+#[start]
+fn start(_: isize, _: *const *const u8) -> isize {
let _e: Enum;
+ 0
}