Skip to content

Commit 50ddcbb

Browse files
committed
also check the iterator is not too long
1 parent 5719f57 commit 50ddcbb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#![feature(nll)]
4444
#![feature(non_exhaustive)]
4545
#![feature(optin_builtin_traits)]
46+
#![feature(option_expect_none)]
4647
#![feature(range_is_empty)]
4748
#![feature(slice_patterns)]
4849
#![feature(specialization)]

src/librustc/mir/interpret/allocation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
356356
for dest in bytes {
357357
*dest = src.next().expect("iterator was shorter than it said it would be");
358358
}
359+
src.next().expect_none("iterator was longer than it said it would be");
359360
Ok(())
360361
}
361362

0 commit comments

Comments
 (0)