diff options
| author | Ralf Jung <post@ralfj.de> | 2019-10-20 12:06:03 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-10-20 12:06:03 +0200 |
| commit | 50ddcbb2f5004da5b2d805c079e7c9699b6b7bea (patch) | |
| tree | 69ac11604e9ea807cef58fc52e5bd2ffad40a52e | |
| parent | 5719f57fb1628e33765393d886f1638bfa0da059 (diff) | |
| download | rust-50ddcbb2f5004da5b2d805c079e7c9699b6b7bea.tar.gz rust-50ddcbb2f5004da5b2d805c079e7c9699b6b7bea.zip | |
also check the iterator is not too long
| -rw-r--r-- | src/librustc/lib.rs | 1 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/allocation.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8943fc342c0..3b0ac9ada8f 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -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)] diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 3bcde8defdf..87e9b91a86c 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -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(()) } |
