@@ -1121,11 +1121,11 @@ fn test_try_reserve() {
1121
1121
} else { panic ! ( "usize::MAX should trigger an overflow!" ) }
1122
1122
} else {
1123
1123
// Check isize::MAX + 1 is an OOM
1124
- if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_CAP + 1 ) {
1124
+ if let Err ( AllocError { .. } ) = empty_bytes. try_reserve ( MAX_CAP + 1 ) {
1125
1125
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1126
1126
1127
1127
// Check usize::MAX is an OOM
1128
- if let Err ( AllocErr ) = empty_bytes. try_reserve ( MAX_USIZE ) {
1128
+ if let Err ( AllocError { .. } ) = empty_bytes. try_reserve ( MAX_USIZE ) {
1129
1129
} else { panic ! ( "usize::MAX should trigger an OOM!" ) }
1130
1130
}
1131
1131
}
@@ -1145,7 +1145,7 @@ fn test_try_reserve() {
1145
1145
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1146
1146
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1147
1147
} else {
1148
- if let Err ( AllocErr ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1148
+ if let Err ( AllocError { .. } ) = ten_bytes. try_reserve ( MAX_CAP - 9 ) {
1149
1149
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1150
1150
}
1151
1151
// Should always overflow in the add-to-len
@@ -1168,7 +1168,7 @@ fn test_try_reserve() {
1168
1168
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1169
1169
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1170
1170
} else {
1171
- if let Err ( AllocErr ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1171
+ if let Err ( AllocError { .. } ) = ten_u32s. try_reserve ( MAX_CAP /4 - 9 ) {
1172
1172
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1173
1173
}
1174
1174
// Should fail in the mul-by-size
@@ -1209,10 +1209,10 @@ fn test_try_reserve_exact() {
1209
1209
if let Err ( CapacityOverflow ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1210
1210
} else { panic ! ( "usize::MAX should trigger an overflow!" ) }
1211
1211
} else {
1212
- if let Err ( AllocErr ) = empty_bytes. try_reserve_exact ( MAX_CAP + 1 ) {
1212
+ if let Err ( AllocError { .. } ) = empty_bytes. try_reserve_exact ( MAX_CAP + 1 ) {
1213
1213
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1214
1214
1215
- if let Err ( AllocErr ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1215
+ if let Err ( AllocError { .. } ) = empty_bytes. try_reserve_exact ( MAX_USIZE ) {
1216
1216
} else { panic ! ( "usize::MAX should trigger an OOM!" ) }
1217
1217
}
1218
1218
}
@@ -1231,7 +1231,7 @@ fn test_try_reserve_exact() {
1231
1231
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1232
1232
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1233
1233
} else {
1234
- if let Err ( AllocErr ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1234
+ if let Err ( AllocError { .. } ) = ten_bytes. try_reserve_exact ( MAX_CAP - 9 ) {
1235
1235
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1236
1236
}
1237
1237
if let Err ( CapacityOverflow ) = ten_bytes. try_reserve_exact ( MAX_USIZE ) {
@@ -1252,7 +1252,7 @@ fn test_try_reserve_exact() {
1252
1252
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1253
1253
} else { panic ! ( "isize::MAX + 1 should trigger an overflow!" ) ; }
1254
1254
} else {
1255
- if let Err ( AllocErr ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1255
+ if let Err ( AllocError { .. } ) = ten_u32s. try_reserve_exact ( MAX_CAP /4 - 9 ) {
1256
1256
} else { panic ! ( "isize::MAX + 1 should trigger an OOM!" ) }
1257
1257
}
1258
1258
if let Err ( CapacityOverflow ) = ten_u32s. try_reserve_exact ( MAX_USIZE - 20 ) {
0 commit comments