about summary refs log tree commit diff
path: root/library/alloctests
AgeCommit message (Collapse)AuthorLines
2025-09-26Rollup merge of #145113 - petrochenkov:lessfinalize, r=lcnrMatthias Krüger-1/+0
resolve: Do not finalize shadowed bindings I.e. do not mark them as used, or non-speculatively loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-25resolve: Do not finalize shadowed bindingsVadim Petrochenkov-1/+0
I.e. do not mark them as used, or non-speculative loaded, or similar. Previously they were sometimes finalized during early resolution, causing issues like https://github.com/rust-lang/rust/pull/144793#issuecomment-3168108005.
2025-09-24feature: Implement vec_try_removeBenjaminBrienen-0/+16
Vec::try_remove is a non-panicking version of Vec::remove
2025-09-18Plumb Allocator generic into `std::vec::PeekMut`Sidney Cammeresi-9/+10
2025-09-14Switch `std::vec::PeekMut::pop` from self to this parameter.Sidney Cammeresi-2/+2
Since PeekMut implements Deref, it shouldn't have any methods of its own. See also: `std::collections::binary_heap::PeekMut::pop`
2025-09-13Rollup merge of #145471 - rs-sac:extr, r=the8472Jacob Pratt-2/+0
Stabilize BTree{Map,Set}::extract_if Tracking issue: rust-lang/rust#70530 FCP completed: https://github.com/rust-lang/rust/issues/70530#issuecomment-3191454465 Closes: rust-lang/rust#70530
2025-09-03Rollup merge of #145279 - clarfonthey:const-convert-initial, r=tgross35Stuart Cook-0/+1
Constify conversion traits (part 1) This is the first part of rust-lang/rust#144289 being split into smaller pieces. It adds/moves constness of several traits under the `const_convert` feature: * `From` * `Into` * `TryFrom` * `TryInto` * `FromStr` * `AsRef` * `AsMut` * `Borrow` * `BorrowMut` * `Deref` * `DerefMut` There are a few methods that are intrinsically tied to these traits which I've included in the feature. Particularly, those which are wrappers over `AsRef`: * `ByteStr::new` (unstable under `bstr` feature) * `OsStr::new` * `Path::new` Those which directly use `Into`: * `Result::into_ok` * `Result::into_err` And those which use `Deref` and `DerefMut`: * `Pin::as_ref` * `Pin::as_mut` * `Pin::as_deref_mut` * `Option::as_deref` * `Option::as_deref_mut` * `Result::as_deref` * `Result::as_deref_mut` (note: the `Option` and `Result` methods were suggested by ``@npmccallum`` initially as rust-lang/rust#146101) The parts which are missing from this PR are: * Anything that involves heap-allocated types * Making any method const than the ones listed above * Anything that could rely on the above, *or* could rely on system-specific code for `OsStr` or `Path` (note: this mostly makes these methods useless since `str` doesn't implement `AsRef<OsStr>` yet, but it's better to track the method for now and add impls later, IMHO) r? ``@tgross35`` (who mostly already reviewed this)
2025-09-01Constify conversion traitsltdk-0/+1
2025-08-29Rollup merge of #145756 - okaneco:stabilize_char_boundary, r=scottmcmTrevor Gross-1/+0
str: Stabilize `round_char_boundary` feature Closes https://github.com/rust-lang/rust/issues/93743 FCP completed https://github.com/rust-lang/rust/issues/93743#issuecomment-3168382171
2025-08-27Stabilize BTree{Map,Set}::extract_ifSidney Cammeresi-2/+0
2025-08-22Stabilize `round_char_boundary` featureokaneco-1/+0
2025-08-20Move WTF-8 code from std to core/allocltdk-3/+10
2025-07-03Add test for `int_format_into` featureGuillaume Gomez-20/+27
2025-06-20Rollup merge of #142668 - hkBst:less-static-mut, r=tgross35Trevor Gross-211/+113
vec_deque/fmt/vec tests: remove static mut More rust-lang/rust#125035. r? ```@tgross35```
2025-06-20Auto merge of #142294 - GuillaumeGomez:specialize-tostring-on-128-integers, ↵bors-0/+4
r=tgross35 Use a distinct `ToString` implementation for `u128` and `i128` Part of https://github.com/rust-lang/rust/issues/135543. Follow-up of rust-lang/rust#136264. When working on https://github.com/rust-lang/rust/pull/142098, I realized that `i128` and `u128` could also benefit from a distinct `ToString` implementation so here it. The last commit is just me realizing that I forgot to add the format tests for `usize` and `isize`. Here is the bench comparison: | bench name | last nightly | with this PR | diff | |-|-|-|-| | bench_i128 | 29.25 ns/iter (+/- 0.66) | 17.52 ns/iter (+/- 0.7) | -40.1% | | bench_u128 | 34.06 ns/iter (+/- 0.21) | 16.1 ns/iter (+/- 0.6) | -52.7% | I used this code to test: ```rust #![feature(test)] extern crate test; use test::{Bencher, black_box}; #[inline(always)] fn convert_to_string<T: ToString>(n: T) -> String { n.to_string() } macro_rules! decl_benches { ($($name:ident: $ty:ident,)+) => { $( #[bench] fn $name(c: &mut Bencher) { c.iter(|| convert_to_string(black_box({ let nb: $ty = 20; nb }))); } )+ } } decl_benches! { bench_u128: u128, bench_i128: i128, } ```
2025-06-19vec_deque alloctests: remove static mutMarijn Schouten-101/+18
2025-06-19vec tests: remove static mutMarijn Schouten-92/+53
2025-06-18remove duplicate crash testMarijn Schouten-82/+5
2025-06-18fmt tests: remove static mutMarijn Schouten-20/+26
2025-06-18vec_deque tests: remove static mutMarijn Schouten-0/+18
2025-06-16Extend num tests on `usize` and `isize` as wellGuillaume Gomez-0/+4
2025-06-13Rollup merge of #142046 - Qelxiros:122742-vec_peek_mut, r=cuviperJubilee-0/+18
add Vec::peek_mut Tracking issue: rust-lang/rust#122742
2025-06-12Rollup merge of #138016 - nwoods-cimpress:slice_chunkby_clone, r=dtolnayMatthias Krüger-0/+13
Added `Clone` implementation for `ChunkBy` Added `Clone` implementation for `ChunkBy` Closes rust-lang/rust#137969.
2025-06-11update docs, testJeremy Smart-0/+2
2025-06-09stabilize nonnull_provenanceRalf Jung-1/+0
2025-06-06fix testsJeremy Smart-4/+8
2025-06-04add Vec::peek_mutJeremy Smart-0/+12
2025-06-02Remove more library bootstrapJosh Stone-1/+0
2025-05-27Update tests with Range parameter to `BTreeMap::extract_if` etc.Sidney Cammeresi-12/+22
2025-05-12update cfg(bootstrap)Pietro Albini-1/+1
2025-05-05Implement `VecDeque::truncate_front()`Vladimir Krivopalov-0/+70
Tracking issue: #140667 Signed-off-by: Vladimir Krivopalov <vladimir.krivopalov@gmail.com>
2025-04-24Suggest {to,from}_ne_bytes for transmutations between arrays and integers, etcbendn-0/+1
2025-04-18Move `<CStr as Debug>` test to coretestsTamir Duberstein-6/+0
2025-04-09Add missing `black_box` in `String` benchmarkslincot-26/+22
2025-04-06Auto merge of #138951 - jwnrt:alloc-raw-vec-strict-prov, r=Noratriebbors-0/+2
Replace last `usize` -> `ptr` transmute in `alloc` with strict provenance API This replaces the `usize -> ptr` transmute in `RawVecInner::new_in` with a strict provenance API (`NonNull::without_provenance`). The API is changed to take an `Alignment` which encodes the non-null constraint needed for `Unique` and allows us to do the construction safely. Two internal-only APIs were added to let us avoid UB-checking in this hot code: `Layout::alignment` to get the `Alignment` type directly rather than as a `usize`, and `Unique::from_non_null` to create `Unique` in const context without a transmute.
2025-04-05Rollup merge of #138546 - GuillaumeGomez:integer-to-string-tests, r=AmanieuStuart Cook-0/+70
Add integer to string formatting tests As discussed in https://github.com/rust-lang/rust/pull/136264, there doesn't seem to have tests to ensure that int to string conversion is performed correctly, only sporadic tests here and there. Now we have some basic tests. :) r? `````@Mark-Simulacrum`````
2025-03-29Add a test for `Weak` created from `UniqueArc::downgrade`Frank King-1/+22
2025-03-26Swap usize -> ptr transmute for strict_pov APIJames Wainwright-0/+1
Removes some unsafety and reduces the number of `usize` -> `ptr` transmutes which might be helpful for CHERI-like targets in the future.
2025-03-26Pass `Alignment` for `RawVecInner::new_in`James Wainwright-0/+1
Encodes the safety constraint that `Unique`'s pointer must be non-zero into the API.
2025-03-23Tweak integer to string conversion test a bit to be future-proofGuillaume Gomez-2/+2
2025-03-22Implement `UniqueArc`Frank King-1/+4
2025-03-16Add integer to string formatting testsGuillaume Gomez-0/+70
2025-03-10Added `Clone` implementation for `ChunkBy`Nathaniel Woods-0/+13
2025-03-07Add commentsbjorn3-0/+3
2025-03-07Fully test the alloc crate through alloctestsbjorn3-3/+325
For the tests that make use of internal implementation details, we include the module to test using #[path] in alloctests now.
2025-03-07Move last remaining Rc test to alloctestsbjorn3-0/+18
2025-03-07Move most Rc tests to alloctestsbjorn3-1/+648
2025-03-07Move all alloc integration tests to a new alloctests cratebjorn3-0/+18749