Panic when advance_slices()'ing too far.
This commit is contained in:
parent
6045c34f15
commit
a23e7513fa
1 changed files with 6 additions and 2 deletions
|
@ -1155,7 +1155,9 @@ impl<'a> IoSliceMut<'a> {
|
|||
}
|
||||
|
||||
*bufs = &mut replace(bufs, &mut [])[remove..];
|
||||
if !bufs.is_empty() {
|
||||
if bufs.is_empty() {
|
||||
assert!(n == accumulated_len, "advancing io slices beyond their length");
|
||||
} else {
|
||||
bufs[0].advance(n - accumulated_len)
|
||||
}
|
||||
}
|
||||
|
@ -1289,7 +1291,9 @@ impl<'a> IoSlice<'a> {
|
|||
}
|
||||
|
||||
*bufs = &mut replace(bufs, &mut [])[remove..];
|
||||
if !bufs.is_empty() {
|
||||
if bufs.is_empty() {
|
||||
assert!(n == accumulated_len, "advancing io slices beyond their length");
|
||||
} else {
|
||||
bufs[0].advance(n - accumulated_len)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue