about summary refs log tree commit diff
path: root/library/alloc/src/vec.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-09-16 08:25:02 +0200
committerGitHub <noreply@github.com>2020-09-16 08:25:02 +0200
commit9d0a265b6cfb0d6fbf3dbbf612cee1835b40bc35 (patch)
tree4a1d9dafc553ea2d3918dfe0e151be3197cd3f83 /library/alloc/src/vec.rs
parent0bcc96dd3d54d459f3ae9a178bac3e7e944a9102 (diff)
parent7d67546a6ade5c1ade4b8e66266411f7aa4fae69 (diff)
downloadrust-9d0a265b6cfb0d6fbf3dbbf612cee1835b40bc35.tar.gz
rust-9d0a265b6cfb0d6fbf3dbbf612cee1835b40bc35.zip
Rollup merge of #76662 - RalfJung:lib-test-miri, r=Mark-Simulacrum
Fix liballoc test suite for Miri

Mostly, fix the regression introduced by https://github.com/rust-lang/rust/pull/75207 that caused slices (i.e., references) to be created to invalid memory or memory that has aliasing pointers that we want to keep valid. @dylni  this changes the type of `check_range` to only require the length, not the full reference to the slice, which indeed is all the information this function requires.

Also reduce the size of a test introduced in https://github.com/rust-lang/rust/pull/70793 to make it not take 3 minutes in Miri.

This makes https://github.com/RalfJung/miri-test-libstd work again.
Diffstat (limited to 'library/alloc/src/vec.rs')
-rw-r--r--library/alloc/src/vec.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/vec.rs b/library/alloc/src/vec.rs
index f9ee2034f31..9dbea0dc9e6 100644
--- a/library/alloc/src/vec.rs
+++ b/library/alloc/src/vec.rs
@@ -1312,7 +1312,7 @@ impl<T> Vec<T> {
         // the hole, and the vector length is restored to the new length.
         //
         let len = self.len();
-        let Range { start, end } = self.check_range(range);
+        let Range { start, end } = slice::check_range(len, range);
 
         unsafe {
             // set self.vec length's to start, to be safe in case Drain is leaked