File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
#![ deny( warnings) ]
12
12
13
+ #![ feature( attr_literals) ]
13
14
#![ feature( box_syntax) ]
14
15
#![ feature( inclusive_range_syntax) ]
15
16
#![ feature( collection_placement) ]
19
20
#![ feature( pattern) ]
20
21
#![ feature( placement_in_syntax) ]
21
22
#![ feature( rand) ]
23
+ #![ feature( repr_align) ]
22
24
#![ feature( slice_rotate) ]
23
25
#![ feature( splice) ]
24
26
#![ feature( step_by) ]
Original file line number Diff line number Diff line change @@ -781,3 +781,18 @@ fn from_into_inner() {
781
781
assert_eq ! ( vec, [ 2 , 3 ] ) ;
782
782
assert ! ( ptr != vec. as_ptr( ) ) ;
783
783
}
784
+
785
+ #[ test]
786
+ fn overaligned_allocations ( ) {
787
+ #[ repr( align( 256 ) ) ]
788
+ struct Foo ( usize ) ;
789
+ let mut v = vec ! [ Foo ( 273 ) ] ;
790
+ for i in 0 ..0x1000 {
791
+ v. reserve_exact ( i) ;
792
+ assert ! ( v[ 0 ] . 0 == 273 ) ;
793
+ assert ! ( v. as_ptr( ) as usize & 0xff == 0 ) ;
794
+ v. shrink_to_fit ( ) ;
795
+ assert ! ( v[ 0 ] . 0 == 273 ) ;
796
+ assert ! ( v. as_ptr( ) as usize & 0xff == 0 ) ;
797
+ }
798
+ }
You can’t perform that action at this time.
0 commit comments