]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-fulldeps/newtype_index.rs
Auto merge of #61817 - eddyb:begone-gcx-attempt-2, r=oli-obk
[rust.git] / src / test / run-pass-fulldeps / newtype_index.rs
1 #![feature(rustc_attrs, rustc_private, step_trait)]
2
3 #[macro_use] extern crate rustc_data_structures;
4 extern crate serialize as rustc_serialize;
5
6 use rustc_data_structures::indexed_vec::Idx;
7
8 newtype_index!(struct MyIdx { MAX = 0xFFFF_FFFA });
9
10 use std::mem::size_of;
11
12 fn main() {
13     assert_eq!(size_of::<MyIdx>(), 4);
14     assert_eq!(size_of::<Option<MyIdx>>(), 4);
15     assert_eq!(size_of::<Option<Option<MyIdx>>>(), 4);
16     assert_eq!(size_of::<Option<Option<Option<MyIdx>>>>(), 4);
17     assert_eq!(size_of::<Option<Option<Option<Option<MyIdx>>>>>(), 4);
18     assert_eq!(size_of::<Option<Option<Option<Option<Option<MyIdx>>>>>>(), 4);
19     assert_eq!(size_of::<Option<Option<Option<Option<Option<Option<MyIdx>>>>>>>(), 8);
20 }