mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
Panic when advance_slices()'ing too far.
This commit is contained in:
parent
6045c34f15
commit
a23e7513fa
@ -1155,7 +1155,9 @@ impl<'a> IoSliceMut<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*bufs = &mut replace(bufs, &mut [])[remove..];
|
*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)
|
bufs[0].advance(n - accumulated_len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1289,7 +1291,9 @@ impl<'a> IoSlice<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*bufs = &mut replace(bufs, &mut [])[remove..];
|
*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)
|
bufs[0].advance(n - accumulated_len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user