Stack
Whenever we hold a value (includes function arguments) we must know its size, so that the stack pointer can be moved properly.
#![allow(unused)] fn main() { struct S { data: [u8; 0x1000], } println!("0x{:x}", std::mem::size_of::<S>()); }
Knowing the size of a value of a type is indicated by the marker trait Sized
.
fn f<T: Sized>(t: T) {}