about summary refs log tree commit diff
path: root/src/liballoc/tests/vec.rs
AgeCommit message (Collapse)AuthorLines
2020-04-09Disable try_reserve tests on AndroidAmanieu d'Antras-0/+2
2020-04-05Rollup merge of #70777 - faern:use-assoc-int-consts2, r=dtolnayDylan DPC-1/+0
Don't import integer and float modules, use assoc consts Stop importing the standard library integer and float modules to reach the `MIN`, `MAX` and other constants. They are available directly on the primitive types now. This PR is a follow up of #69860 which made sure we use the new constants in documentation. This type of change touches a lot of files, and previously all my assoc int consts PRs had collisions and were accepted only after a long delay. So I'd prefer to do it in smaller steps now. Just removing these imports seem like a good next step. r? @dtolnay
2020-04-05Stop importing integer modules in liballocLinus Färnstrand-1/+0
2020-03-30fix and test aliasing in swap_removeRalf Jung-0/+5
2020-03-30fix aliasing in remove()Ralf Jung-1/+6
also add smoke test to detect relocation even in rustc runs
2020-03-30also cover next() path of draining iteratorsRalf Jung-4/+11
2020-03-30test more mutating vector methodsRalf Jung-0/+30
2020-03-30add some testsRalf Jung-4/+18
2020-01-19FormatJonas Schievink-5/+1
2020-01-19Fix leak in vec::IntoIter when a destructor panicsJonas Schievink-0/+29
2020-01-19Avoid leak in `vec::Drain` when item drop panicsJonas Schievink-0/+39
2020-01-04ef em ti ... :Pdylan_DPC-3/+3
2020-01-04add testsdylan_DPC-0/+15
2019-12-22Format the worldMark Rousskov-116/+117
2019-12-07liballoc: ignore tests in Miri instead of removing them entirelyRalf Jung-2/+2
2019-12-01Rollup merge of #66662 - RalfJung:miri-test-liballoc, r=dtolnayMazdak Farrokhzad-3/+2
Miri: run panic-catching tests in liballoc I also converted two tests from using `thread::spawn(...).join()` just for catching panics, to `catch_panic`, so that Miri can run them.
2019-11-26Fix spelling typosBrian Wignall-1/+1
2019-11-22enable panic-catching tests in MiriRalf Jung-3/+2
2019-10-16Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-2/+5
- Compatible with Emscripten 1.38.46-upstream or later upstream. - Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the old incorrect wasm32 C call ABI with the correct one, preserving the old one as wasm32_bindgen_compat for wasm-bindgen compatibility. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-5/+2
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-04Fix ABI, run and fix more tests, re-enable CI for PRsThomas Lively-2/+5
2019-09-29Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadataSimon Sapin-0/+48
https://github.com/rust-lang/rust/pull/49496 introduced specialization based on: ``` unsafe impl<T: ?Sized> IsZero for *mut T { fn is_zero(&self) -> bool { (*self).is_null() } } ``` … to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`, which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component. That is, a fat pointer can be “null” without being made entirely of zero bits. This commit fixes it by removing the `?Sized` bound on this impl (and the corresponding `*const T` one). This regresses `vec![x; n]` with `x` a null raw slice of length zero, but that seems exceptionally uncommon. (Vtable pointers are never null, so raw trait objects would not take the fast path anyway. An alternative to keep the `?Sized` bound (or even generalize to `impl<U: Copy> IsZero for U`) would be to cast to `&[u8]` of length `size_of::<U>()`, but the optimizer seems not to be able to propagate alignment information and sticks with comparing one byte at a time: https://rust.godbolt.org/z/xQFkwL ---- Without the library change, the new test fails as follows: ``` ---- vec::vec_macro_repeating_null_raw_fat_pointer stdout ---- [src/liballoc/tests/vec.rs:1301] ptr_metadata(raw_dyn) = 0x00005596ef95f9a8 [src/liballoc/tests/vec.rs:1306] ptr_metadata(vec[0]) = 0x0000000000000000 thread 'vec::vec_macro_repeating_null_raw_fat_pointer' panicked at 'assertion failed: vec[0] == null_raw_dyn', src/liballoc/tests/vec.rs:1307:5 ```
2019-08-16Add the Layout of the failed allocation to TryReserveError::AllocErrorSimon Sapin-8/+8
… and add a separately-unstable field to force non-exhaustive matching (`#[non_exhaustive]` is no implemented yet on enum variants) so that we have the option to later expose the allocator’s error value. CC https://github.com/rust-lang/wg-allocators/issues/23
2019-08-16Rename CollectionAllocError to TryReserveErrorSimon Sapin-1/+1
2019-07-08Auto merge of #61224 - aloucks:drain_filter, r=Gankrobors-0/+109
Prevent Vec::drain_filter from double dropping on panic Fixes: #60977 The changes in this PR prevent leaking and double-panicking in addition to double-drop. Tracking issue: #43244
2019-07-03enable a few more tests in Miri and update the comment for othersRalf Jung-1/+0
2019-05-27Disable drain_filter tests that require catch_unwind on miriAaron Loucks-0/+2
2019-05-27Add drain_filter_unconsumed testAaron Loucks-0/+8
2019-05-26Prevent Vec::drain_filter from double dropping on panicAaron Loucks-0/+99
Fixes: #60977
2019-05-25add test checking that Vec push/pop does not invalidate pointersRalf Jung-0/+21
2019-05-23fix dangling reference in Vec::appendRalf Jung-2/+3
2019-03-10we can now skip should_panic tests with the libtest harnessRalf Jung-12/+0
2019-02-13review failures in heap, slice, vecRalf Jung-0/+12
2019-02-09Rollup merge of #58275 - RalfJung:miri-test-libcore, r=Mark-SimulacrumMazdak Farrokhzad-0/+2
libcore, liballoc: disable tests in Miri I am going to run the libcore and liballoc unit test suites in Miri. Not all tests pass. This PR disables a whole bunch of tests when running in Miri, to get us to a baseline from which I can investigate failures. Cc @SimonSapin @alexcrichton
2019-02-07disable tests in MiriRalf Jung-0/+2
2019-02-03liballoc: revert nested imports style changes.Mazdak Farrokhzad-7/+5
2019-02-02liballoc: elide some lifetimes.Mazdak Farrokhzad-1/+1
2019-02-02liballoc: adjust abolute imports + more import fixes.Mazdak Farrokhzad-1/+1
2019-02-02liballoc: refactor & fix some imports.Mazdak Farrokhzad-5/+7
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-11Test capacity of ZST vectorKonrad Borowski-0/+5
Initially, #50233 accidentally changed the capacity of empty ZST. This was pointed out during code review. This commit adds a test to prevent capacity of ZST vectors from accidentally changing to prevent that from happening again.
2018-04-12Remove the now-unit-struct AllocErr field inside CollectionAllocErrSimon Sapin-8/+8
2018-04-03Remove all unstable placement featuresAidan Hobson Sayers-19/+1
Closes #22181, #27779
2018-03-15setting ABORTING_MALLOC for asmjs backendsnf-6/+1
2018-03-14try_reserve: disabling tests for asmjs, blocked by #48968snf-1/+6
2018-03-14implementing fallible allocation API (try_reserve) for Vec, String and HashMapsnf-1/+208
2017-11-03Remove unused AsciiExt imports and fix tests related to ascii methodsLukas Kalbertodt-3/+0
Many AsciiExt imports have become useless thanks to the inherent ascii methods added in the last commits. These were removed. In some places, I fully specified the ascii method being called to enforce usage of the AsciiExt trait. Note that some imports are not removed but tagged with a `#[cfg(stage0)]` attribute. This is necessary, because certain ascii methods are not yet available in stage0. All those imports will be removed later. Additionally, failing tests were fixed. The test suite should exit successfully now.
2017-09-22Add support for `..=` syntaxAlex Burka-14/+14
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-07-19Add Vec::drain_filterAlexis Beingessner-0/+167
2017-07-03Document unintuitive argument order for Vec::dedup_by relationAnders Kaseorg-0/+5
When trying to use dedup_by to merge some auxiliary information from removed elements into kept elements, I was surprised to observe that vec.dedup_by(same_bucket) calls same_bucket(a, b) where b appears before a in the vector, and discards a when true is returned. This argument order is probably a bug, but since it has already been stabilized, I guess we should document it as a feature and move on. (Vec::dedup also uses == with this unexpected argument order, but I figure that’s not important since == is expected to be symmetric with no side effects.) Signed-off-by: Anders Kaseorg <andersk@mit.edu>