also check the iterator is not too long

This commit is contained in:
Ralf Jung 2019-10-20 12:06:03 +02:00
parent 5719f57fb1
commit 50ddcbb2f5
2 changed files with 2 additions and 0 deletions

View File

@ -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)]

View File

@ -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(())
}