1 #![feature(box_syntax)]
3 fn make_box() -> Box<(i16, i16)> {
7 fn make_box_syntax() -> Box<(i16, i16)> {
11 fn allocate_reallocate() {
12 let mut s = String::new();
14 // 6 byte heap alloc (__rust_allocate)
16 assert_eq!(s.len(), 6);
17 assert_eq!(s.capacity(), 8);
19 // heap size doubled to 12 (__rust_reallocate)
21 assert_eq!(s.len(), 9);
22 assert_eq!(s.capacity(), 16);
24 // heap size reduced to 9 (__rust_reallocate)
26 assert_eq!(s.len(), 9);
27 assert_eq!(s.capacity(), 9);
31 assert_eq!(*make_box(), (1, 2));
32 assert_eq!(*make_box_syntax(), (1, 2));
33 allocate_reallocate();