From 5bbaac357dd85092ed0fb822947df7a4d60c1db9 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Mar 2020 13:31:16 +0200 Subject: fix and test aliasing in swap_remove --- src/liballoc/tests/vec.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/liballoc/tests') diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs index a90bc58cbfd..6321e7154e7 100644 --- a/src/liballoc/tests/vec.rs +++ b/src/liballoc/tests/vec.rs @@ -1378,6 +1378,11 @@ fn test_stable_pointers() { v.remove(1); v.pop().unwrap(); assert_eq!(*v0, 13); + v.push(1); + v.swap_remove(1); + assert_eq!(v.len(), 2); + v.swap_remove(1); // swap_remove the last element + assert_eq!(*v0, 13); // Appending v.append(&mut vec![27, 19]); -- cgit 1.4.1-3-g733a5