about summary refs log tree commit diff
path: root/src/liballoc/tests
AgeCommit message (Collapse)AuthorLines
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-23/+9
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-9/+23
2019-10-01BTreeSet intersection, difference & is_subnet optimizationsStein Somers-18/+92
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-09-16Improve BTreeSet::Intersection::size_hintpcpthm-0/+11
The commented invariant that an iterator is smaller than other iterator was violated after next is called and two iterators are consumed at different rates.
2019-08-16Add the Layout of the failed allocation to TryReserveError::AllocErrorSimon Sapin-20/+20
… 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-3/+3
2019-08-10Rollup merge of #63350 - iluuu1994:use-associated-type-bounds, r=CentrilMazdak Farrokhzad-4/+7
Use associated_type_bounds where applicable - closes #61738
2019-08-09Rollup merge of #63407 - RalfJung:miri-test-sizes, r=CentrilMazdak Farrokhzad-0/+27
reduce some test sizes in Miri
2019-08-09reduce some test sizes in MiriRalf Jung-0/+27
2019-08-09Add missing #![feature(associated_type_bounds)]Ilija Tovilo-0/+1
2019-08-09Merge pull request #1 from rust-lang/masterSayan Nandan-96/+490
Merge recent changes into master
2019-08-09Improve tests for liballoc/btree/setSayan Nandan-2/+2
2019-08-08Use associated_type_bounds where applicable - closes #61738Ilija Tovilo-4/+6
2019-08-02Remove some more `cfg(test)`sVadim Petrochenkov-3/+0
2019-07-29comments from @lzutaoMaximilian Roos-1/+1
2019-07-29impl Debug for CharsMaximilian Roos-0/+10
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-1/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-13Auto merge of #61953 - Centril:shared-from-iter, r=RalfJungbors-0/+240
Add `impl<T> FromIterator<T> for Arc/Rc<[T]>` Add implementations of `FromIterator<T> for Arc/Rc<[T]>` with symmetrical logic. This also takes advantage of specialization in the case of iterators with known length (`TrustedLen`) to elide the final allocation/copying from a `Vec<T>` into `Rc<[T]>` because we can allocate the space for the `Rc<[T]>` directly when the size is known. This is the primary motivation and why this is to be preferred over `iter.collect::<Vec<_>>().into(): Rc<[T]>`. Moreover, this PR does some refactoring in some places. r? @RalfJung for the code cc @alexcrichton from T-libs
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-06Rollup merge of #62296 - RalfJung:memalign, r=alexcrichtonMazdak Farrokhzad-15/+17
request at least ptr-size alignment from posix_memalign Fixes https://github.com/rust-lang/rust/issues/62251
2019-07-03enable a few more tests in Miri and update the comment for othersRalf Jung-1/+0
2019-07-02test more possible overaligned requestsRalf Jung-15/+17
2019-06-21shared_from_iter: Polish internal docs.Mazdak Farrokhzad-0/+2
2019-06-21shared_from_iter: Add more tests.Mazdak Farrokhzad-0/+238
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-05-19Rollup merge of #60931 - cuviper:array-iter, r=KodrAusMazdak Farrokhzad-2/+2
Use iter() for iterating arrays by slice These `into_iter()` calls will change from iterating references to values if we ever get `IntoIterator` for arrays, which may break the code using that iterator. Calling `iter()` is future proof.
2019-05-17Use iter() for iterating arrays by sliceJosh Stone-2/+2
These `into_iter()` calls will change from iterating references to values if we ever get `IntoIterator` for arrays, which may break the code using that iterator. Calling `iter()` is future proof.
2019-05-09make vecdeque_rotate stableDodo-1/+0
2019-04-20Deny rust_2018_idioms in liballoc testsPhilipp Hansch-14/+15
2019-04-17test sort_unstable in MiriRalf Jung-3/+3
2019-04-16Miri now supports entropy, but is still slowRalf Jung-7/+16
2019-03-29improve worst-case performance of BTreeSet difference and intersectionStein Somers-0/+61
2019-03-16Rollup merge of #59206 - sntdevco:master, r=dtolnaykennytm-1/+1
Improved test output
2019-03-15Improved test output for liballoc/strsntdevco-1/+1
2019-03-10enabled too many testsRalf Jung-1/+3
2019-03-10we can now skip should_panic tests with the libtest harnessRalf Jung-57/+1
2019-02-25Remove some unnecessary 'extern crate'Taiki Endo-3/+0
2019-02-22Rollup merge of #58064 - llogiq:vec-deque-try-rfold, r=scottmcmMazdak Farrokhzad-0/+64
override `VecDeque::try_rfold`, also update iterator This keeps the slice based iteration and updates the iterator state after each slice. It also uses a loop to reduce the amount of code. This uses unsafe code, so some thorough review would be appreciated. Cc @RalfJung
2019-02-18override `VecDeque::try_rfold`, also update iteratorAndre Bogus-0/+64
This keeps the slice based iteration and updates the iterator state after each slice. It also uses a loop to reduce the amount of code. This uses unsafe code, so some thorough review would be appreciated.
2019-02-16Rollup merge of #58433 - RalfJung:miri-mark-tests, r=TimNNkennytm-41/+98
Update which libcore/liballoc tests Miri ignores, and document why
2019-02-13miri: test with slightly larger BTreesRalf Jung-8/+10
2019-02-13review failures in heap, slice, vecRalf Jung-4/+32
2019-02-13review failures in btree, stringRalf Jung-5/+42
2019-02-13review failures in binary_heap, str, vec_dequeRalf Jung-33/+23
2019-02-12Stabilize slice_sort_by_cached_keyScott McMurray-1/+0