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 1
1
[package ]
2
2
name = " hashbrown"
3
- version = " 0.4 .0"
3
+ version = " 0.5 .0"
4
4
authors = [
" Amanieu d'Antras <[email protected] >" ]
5
5
description = " A Rust port of Google's SwissTable hash map"
6
6
license = " Apache-2.0/MIT"
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ pub enum CollectionAllocErr {
88
88
/// Error due to the computed capacity exceeding the collection's maximum
89
89
/// (usually `isize::MAX` bytes).
90
90
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
+ } ,
93
96
}
Original file line number Diff line number Diff line change @@ -3402,12 +3402,12 @@ mod test_map {
3402
3402
panic ! ( "usize::MAX should trigger an overflow!" ) ;
3403
3403
}
3404
3404
3405
- if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_USIZE / 8 ) {
3405
+ if let Err ( AllocErr { .. } ) = empty_bytes. try_reserve ( MAX_USIZE / 8 ) {
3406
3406
} else {
3407
3407
// This may succeed if there is enough free memory. Attempt to
3408
3408
// allocate a second hashmap to ensure the allocation will fail.
3409
3409
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 ) {
3411
3411
} else {
3412
3412
panic ! ( "usize::MAX / 8 should trigger an OOM!" ) ;
3413
3413
}
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ impl Fallibility {
83
83
#[ inline]
84
84
fn alloc_err ( self , layout : Layout ) -> CollectionAllocErr {
85
85
match self {
86
- Fallibility :: Fallible => CollectionAllocErr :: AllocErr ,
86
+ Fallibility :: Fallible => CollectionAllocErr :: AllocErr { layout } ,
87
87
Fallibility :: Infallible => handle_alloc_error ( layout) ,
88
88
}
89
89
}
You can’t perform that action at this time.
0 commit comments