]> git.lizzy.rs Git - rust.git/blob - tests/ui/functions-closures/fn-item-type-zero-sized.rs
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / functions-closures / fn-item-type-zero-sized.rs
1 // run-pass
2 // Test that fn item types are zero-sized.
3
4 use std::mem::{size_of, size_of_val};
5
6 fn main() {
7     assert_eq!(size_of_val(&main), 0);
8
9     let (a, b) = (size_of::<u8>, size_of::<u16>);
10     assert_eq!(size_of_val(&a), 0);
11     assert_eq!(size_of_val(&b), 0);
12     assert_eq!((a(), b()), (1, 2));
13 }