1 #![feature(custom_attribute, box_syntax)]
2 #![allow(dead_code, unused_attributes)]
5 fn make_box() -> Box<(i16, i16)> {
10 fn make_box_syntax() -> Box<(i16, i16)> {
15 fn allocate_reallocate() {
16 let mut s = String::new();
18 // 6 byte heap alloc (__rust_allocate)
20 assert_eq!(s.len(), 6);
21 assert_eq!(s.capacity(), 6);
23 // heap size doubled to 12 (__rust_reallocate)
25 assert_eq!(s.len(), 9);
26 assert_eq!(s.capacity(), 12);
28 // heap size reduced to 9 (__rust_reallocate)
30 assert_eq!(s.len(), 9);
31 assert_eq!(s.capacity(), 9);
36 assert_eq!(*make_box(), (1, 2));
37 assert_eq!(*make_box_syntax(), (1, 2));