summary refs log tree commit diff
path: root/library/alloc/src/boxed.rs
AgeCommit message (Collapse)AuthorLines
2024-06-10replace version placeholderPietro Albini-12/+12
2024-05-20Add the impls for Box<[T]>: IntoIteratorMichael Goulet-0/+86
Co-authored-by: ltdk <usr@ltdk.xyz>
2024-05-05alloc: implement FromIterator for Box<str>Caleb Sander-0/+48
Box<[T]> implements FromIterator<T> using Vec<T> + into_boxed_slice(). Add analogous FromIterator implementations for Box<str> matching the current implementations for String. Remove the Global allocator requirement for FromIterator<Box<str>> too.
2024-04-17Rollup merge of #122201 - coolreader18:doc-clone_from, r=dtolnayMatthias Krüger-4/+22
Document overrides of `clone_from()` in core/std As mentioned in https://github.com/rust-lang/rust/pull/96979#discussion_r1379502413 Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source". I reused some of the wording over and over for similar impls, but I'm not sure that the wording is actually *good*. Would appreciate feedback about that. Also, now some of these seem to provide pretty specific guarantees about behavior (e.g. will reuse the exact same allocation iff the len is the same), but I was basing it off of the docs for [`Box::clone_from`](https://doc.rust-lang.org/1.75.0/std/boxed/struct.Box.html#method.clone_from-1) - I'm not sure if providing those strong guarantees is actually good or not.
2024-04-16Box::into_raw: make Miri understand that this is a box-to-raw castRalf Jung-2/+6
2024-03-25Require DerefPure for patternsMichael Goulet-1/+4
2024-03-19Only split by-ref/by-move futures for async closuresMichael Goulet-5/+3
2024-03-18add_retag: ensure box-to-raw-ptr casts are preserved for MiriRalf Jung-11/+6
2024-03-09miri: do not apply aliasing restrictions to Box with custom allocatorRalf Jung-10/+14
2024-03-08Document overrides of `clone_from()`Noa-4/+22
Specifically, when an override doesn't just forward to an inner type, document the behavior and that it's preferred over simply assigning a clone of source. Also, change instances where the second parameter is "other" to "source".
2024-03-05only set noalias on Box with the global allocatorRalf Jung-0/+3
2024-02-22Auto merge of #118634 - Jules-Bertholet:box-allocator-static, r=Amanieubors-9/+3
Remove useless `'static` bounds on `Box` allocator #79327 added `'static` bounds to the allocator parameter for various `Box` + `Pin` APIs to ensure soundness. But it was a bit overzealous, some of the bounds aren't actually needed.
2024-02-06Harmonize blanket implementations for AsyncFn* traitsMichael Goulet-0/+29
2024-02-05Rollup merge of #113833 - WiktorPrzetacznik:master, r=dtolnayMatthias Krüger-8/+8
`std::error::Error` -> Trait Implementations: lifetimes consistency improvement This cleans up `std::error::Error` trait implementations lifetime inconsistency (`'static` -> `'a`) **Reasoning:** Trait implementations for `std::error::Error`, like: `impl From<&str> for Box<dyn Error + 'static, Global>` `impl<'a> From<&str> for Box<dyn Error + Sync + Send + 'a, Global>` use different lifetime annotations misleadingly implying using different life annotations here is a conscious, nonaccidental decision. [(Related forum discussion here)](https://users.rust-lang.org/t/confusing-std-error-source-code/97011/5?u=wiktor)
2024-01-26Fix outdated comment on Boxbjorn3-2/+1
2024-01-02Adjust library tests for unused_tuple_struct_fields -> dead_codeJake Goulding-0/+1
2023-12-04Remove useless `'static` bounds on `Box` allocatorJules Bertholet-9/+3
#79327 added `'static` bounds to the allocator parameter for various `Box` + `Pin` APIs to ensure soundness. But it was a bit overzealous, some of the bounds aren't actually needed.
2023-11-04docs: clarify explicitly freeing heap allocated memoryalpharush-3/+11
2023-10-31delegate box error provideBugen Zhao-0/+4
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
2023-10-21Update boxed.rsGimbles-1/+1
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-10-20s/Generator/Coroutine/Oli Scherer-5/+5
2023-08-14avoid transmuting Box when we can just cast raw pointers insteadRalf Jung-2/+2
2023-07-18std::error::Error -> Trait Implementations: lifetimes consistency improvementWiktorPrzetacznik-8/+8
2023-07-13Eliminate ZST allocations in `Box` and `Vec`Amanieu d'Antras-15/+29
2023-06-16remove box_free and replace with drop implDrMeepster-1/+9
2023-04-29`cfg`-gate `BoxFromSlice` traitJules Bertholet-0/+1
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2023-04-26Loosen `From<&[T]> for Box<[T]>` bound to T: CloneJules Bertholet-8/+30
2023-04-16fix allocDeadbeef-12/+6
2023-04-16rm const traits in libcoreDeadbeef-10/+5
2023-04-12remove some unneeded importsKaDiWa-5/+2
2023-03-28Remove ~const from allocJubilee Young-28/+16
2023-03-03Make `unused_allocation` lint warn against `Box::new`Maybe Waffle-0/+1
2023-02-27Remove or justify use of #[rustc_box]Ben Kimock-5/+4
2022-12-28Update bootstrap cfgPietro Albini-30/+0
2022-12-28Rollup merge of #104024 - noeddl:unused-must-use, r=compiler-errorsfee1-dead-1/+1
Fix `unused_must_use` warning for `Box::from_raw`
2022-12-19Update coerce_unsized tracking issue from #27732 to #18598Anders Kaseorg-1/+1
Issue #27732 was closed as a duplicate of #18598. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-11-22Rollup merge of #101655 - dns2utf8:box_docs, r=dtolnayManish Goregaokar-1/+1
Make the Box one-liner more descriptive I would like to avoid a definition that relies on itself. r? `@GuillaumeGomez`
2022-11-21Touch up Box<T> one-linerDavid Tolnay-2/+2
2022-11-06Bump version placeholders to releaseMark Rousskov-1/+1
2022-11-05Fix unused_must_use warning for Box::from_rawAnett Seeker-1/+1
2022-11-05Enforce Tuple trait on Fn traitsMichael Goulet-0/+31
2022-10-17Auto merge of #101837 - scottmcm:box-array-from-vec, r=m-ou-sebors-1/+50
Add `Box<[T; N]>: TryFrom<Vec<T>>` We have `[T; N]: TryFrom<Vec<T>>` (#76310) and `Box<[T; N]>: TryFrom<Box<[T]>>`, but not this combination. `vec.into_boxed_slice().try_into()` isn't quite a replacement for this, as that'll reallocate unnecessarily in the error case. **Insta-stable, so needs an FCP** (I tried to make this work with `, A`, but that's disallowed because of `#[fundamental]` https://github.com/rust-lang/rust/issues/29635#issuecomment-1247598385)
2022-09-26remove cfg(bootstrap)Pietro Albini-14/+0
2022-09-17Add `Box<[T; N]>: TryFrom<Vec<T>>`Scott McMurray-1/+50
We have `[T; N]: TryFrom<Vec<T>>` and `Box<[T; N]>: TryFrom<Box<[T]>>`, but not the combination. `vec.into_boxed_slice().try_into()` isn't quite a replacement for this, as that'll reallocate unnecessarily in the error case. **Insta-stable, so needs an FCP**
2022-09-16Do not implement `Unpin` as constDeadbeef-2/+1
2022-09-10Make the one-liner more descriptiveStefan Schindler-2/+2
2022-08-28Rollup merge of #99570 - XrXr:box-from-slice-docs, r=thomccMatthias Krüger-1/+1
Box::from(slice): Clarify that contents are copied A colleague mentioned that they interpreted the old text as saying that only the pointer and the length are copied. Add a clause so it is more clear that the pointed to contents are also copied.
2022-08-22Move error trait into coreJane Losare-Lusby-0/+306
2022-08-20Improve primitive/std docs separation and headersCameron Steffen-1/+1