also check the iterator is not too long
This commit is contained in:
parent
5719f57fb1
commit
50ddcbb2f5
@ -43,6 +43,7 @@
|
||||
#![feature(nll)]
|
||||
#![feature(non_exhaustive)]
|
||||
#![feature(optin_builtin_traits)]
|
||||
#![feature(option_expect_none)]
|
||||
#![feature(range_is_empty)]
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(specialization)]
|
||||
|
@ -356,6 +356,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
|
||||
for dest in bytes {
|
||||
*dest = src.next().expect("iterator was shorter than it said it would be");
|
||||
}
|
||||
src.next().expect_none("iterator was longer than it said it would be");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user