File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " hashbrown"
3- version = " 0.4 .0"
3+ version = " 0.5 .0"
44authors = [" Amanieu d'Antras <amanieu@gmail.com>" ]
55description = " A Rust port of Google's SwissTable hash map"
66license = " Apache-2.0/MIT"
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ pub enum CollectionAllocErr {
8888 /// Error due to the computed capacity exceeding the collection's maximum
8989 /// (usually `isize::MAX` bytes).
9090 CapacityOverflow ,
91- /// Error due to the allocator (see the `AllocErr` type's docs).
92- AllocErr ,
91+ /// Error due to the allocator.
92+ AllocErr {
93+ /// The layout of the allocation request that failed.
94+ layout : alloc:: alloc:: Layout ,
95+ } ,
9396}
Original file line number Diff line number Diff line change @@ -3402,12 +3402,12 @@ mod test_map {
34023402 panic ! ( "usize::MAX should trigger an overflow!" ) ;
34033403 }
34043404
3405- if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_USIZE / 8 ) {
3405+ if let Err ( AllocErr { .. } ) = empty_bytes. try_reserve ( MAX_USIZE / 8 ) {
34063406 } else {
34073407 // This may succeed if there is enough free memory. Attempt to
34083408 // allocate a second hashmap to ensure the allocation will fail.
34093409 let mut empty_bytes2: HashMap < u8 , u8 > = HashMap :: new ( ) ;
3410- if let Err ( AllocErr ) = empty_bytes2. try_reserve ( MAX_USIZE / 8 ) {
3410+ if let Err ( AllocErr { .. } ) = empty_bytes2. try_reserve ( MAX_USIZE / 8 ) {
34113411 } else {
34123412 panic ! ( "usize::MAX / 8 should trigger an OOM!" ) ;
34133413 }
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ impl Fallibility {
8383 #[ inline]
8484 fn alloc_err ( self , layout : Layout ) -> CollectionAllocErr {
8585 match self {
86- Fallibility :: Fallible => CollectionAllocErr :: AllocErr ,
86+ Fallibility :: Fallible => CollectionAllocErr :: AllocErr { layout } ,
8787 Fallibility :: Infallible => handle_alloc_error ( layout) ,
8888 }
8989 }
You can’t perform that action at this time.
0 commit comments