File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 1010
1111#![ deny( warnings) ]
1212
13+ #![ feature( attr_literals) ]
1314#![ feature( box_syntax) ]
1415#![ feature( inclusive_range_syntax) ]
1516#![ feature( collection_placement) ]
1920#![ feature( pattern) ]
2021#![ feature( placement_in_syntax) ]
2122#![ feature( rand) ]
23+ #![ feature( repr_align) ]
2224#![ feature( slice_rotate) ]
2325#![ feature( splice) ]
2426#![ feature( step_by) ]
Original file line number Diff line number Diff line change @@ -781,3 +781,18 @@ fn from_into_inner() {
781781 assert_eq ! ( vec, [ 2 , 3 ] ) ;
782782 assert ! ( ptr != vec. as_ptr( ) ) ;
783783}
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