File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1705,6 +1705,7 @@ impl Bump {
1705
1705
// If the pointer is the last allocation we made, we can reuse the bytes,
1706
1706
// otherwise they are simply leaked -- at least until somebody calls reset().
1707
1707
if self . is_last_allocation ( ptr) {
1708
+ let ptr = self . current_chunk_footer . get ( ) . as_ref ( ) . ptr . get ( ) ;
1708
1709
let ptr = NonNull :: new_unchecked ( ptr. as_ptr ( ) . add ( layout. size ( ) ) ) ;
1709
1710
self . current_chunk_footer . get ( ) . as_ref ( ) . ptr . set ( ptr) ;
1710
1711
}
Original file line number Diff line number Diff line change @@ -209,3 +209,14 @@ fn test_chunk_capacity() {
209
209
b. alloc ( true ) ;
210
210
assert ! ( b. chunk_capacity( ) < orig_capacity) ;
211
211
}
212
+
213
+ #[ test]
214
+ #[ cfg( feature = "allocator_api" ) ]
215
+ fn miri_stacked_borrows_issue_247 ( ) {
216
+ let bump = bumpalo:: Bump :: new ( ) ;
217
+
218
+ let a = Box :: into_raw ( Box :: new_in ( 1u8 , & bump) ) ;
219
+ drop ( unsafe { Box :: from_raw_in ( a, & bump) } ) ;
220
+
221
+ let _b = Box :: new_in ( 2u16 , & bump) ;
222
+ }
You can’t perform that action at this time.
0 commit comments