about summary refs log tree commit diff
path: root/library/alloc/src
AgeCommit message (Collapse)AuthorLines
2023-08-22Replace version placeholders with 1.73.0Mark Rousskov-2/+2
2023-08-22Auto merge of #113365 - dima74:diralik/add-deprecated-suggestions, ↵bors-1/+2
r=workingjubilee Add `suggestion` for some `#[deprecated]` items Consider code: ```rust fn main() { let _ = ["a", "b"].connect(" "); } ``` Currently it shows deprecated warning: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default ``` This PR adds `suggestion` for `connect` and some other deprecated items, so the warning will be changed to this: ```rust warning: use of deprecated method `std::slice::<impl [T]>::connect`: renamed to join --> src/main.rs:2:24 | 2 | let _ = ["a", "b"].connect(" "); | ^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 2 | let _ = ["a", "b"].join(" "); | ^^^^ ```
2023-08-21Add `suggestion` for some `#[deprecated]` itemsDmitry Murzin-1/+2
2023-08-19Correct and expand documentation of `handle_alloc_error` and ↵Kevin Reid-6/+19
`set_alloc_error_hook`. Add the following facts: * `handle_alloc_error` may panic instead of aborting. * What happens if a hook returns rather than diverging. * A hook may panic. (This was already demonstrated in an example, but not stated in prose.) * A hook must be sound to call — it cannot assume that it is only called by the runtime, since its function pointer can be retrieved by safe code.
2023-08-18resolve conflictsKyle Lin-0/+1
2023-08-18relax redundancy constraintKyle Lin-4/+2
2023-08-17Auto merge of #114799 - RalfJung:less-transmute, r=m-ou-sebors-2/+2
avoid transmuting Box when we can just cast raw pointers instead Always better to avoid a transmute, in particular when the layout assumptions it is making are not clearly documented. :)
2023-08-16Update library/alloc/src/vec/mod.rsManish Goregaokar-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-16Update library/alloc/src/vec/mod.rsManish Goregaokar-1/+2
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-16Rollup merge of #114867 - ttsugriy:ttsugriy-patch-1, r=scottmcmMatthias Krüger-1/+1
[nit] Fix a comment typo.
2023-08-15other elementsManish Goregaokar-3/+3
2023-08-15[nit] Fix a comment typo.Taras Tsugrii-1/+1
2023-08-15fix typo: affect -> effectRalf Jung-1/+1
2023-08-15Update library/alloc/src/vec/mod.rsManish Goregaokar-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-15Update library/alloc/src/vec/mod.rsManish Goregaokar-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-14avoid transmuting Box when we can just cast raw pointers insteadRalf Jung-2/+2
2023-08-13core/any: remove Provider traitwayne warren-2/+1
* remove `impl Provider for Error` * rename `Demand` to `Request` * update docstrings to focus on the conceptual API provided by `Request` * move `core::any::{request_ref, request_value}` functions into `core::error` * move `core::any::tag`, `core::any::Request`, an `core::any::TaggedOption` into `core::error` * replace `provide_any` feature name w/ `error_generic_member_access` * move `core::error::request_{ref,value} tests into core::tests::error module * update unit and doc tests
2023-08-12aliasing guaranteeManish Goregaokar-25/+40
2023-08-10Rollup merge of #114402 - tifv:tifv-fix-rc-doc, r=cuviperMichael Goulet-3/+3
Fix documentation of impl From<Vec<T>> for Rc<[T]> The example in the documentation of `impl From<Vec<T>> for <Rc<[T]>` is irrelevant (likely was copied from `impl From<Box<T>> for <Rc<T>`). I suggest taking corresponding example from the documentation of `Arc` and replacing `Arc` with `Rc`.
2023-08-10Rollup merge of #114257 - rytheo:linked-list-avoid-unique, r=cuviperMichael Goulet-11/+13
Avoid using `ptr::Unique` in `LinkedList` code Addresses a [comment](https://github.com/rust-lang/rust/pull/103093#discussion_r1268506747) by `@RalfJung` about avoiding use of `core::ptr::Unique` in the standard library.
2023-08-07Rollup merge of #114365 - tshepang:patch-6, r=Mark-SimulacrumMatthias Krüger-6/+0
str.rs: remove "Basic usage" text Only one example is given
2023-08-07Rollup merge of #114362 - tshepang:patch-1, r=Mark-SimulacrumMatthias Krüger-72/+1
string.rs: remove "Basic usage" text Only a single example is given
2023-08-06Add #[rustc_never_returns_null_ptr] to std functionsest31-0/+6
Add the attribute to standard library functions that are guaranteed to never return null pointers, as their originating data wouldn't allow it.
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-03Fix documentation of Rc as From<Vec<T>>July Tikhonov-3/+3
2023-08-02str.rs: remove "Basic usage" textTshepang Mbambo-6/+0
Only one example is given
2023-08-02string.rs: remove "Basic usage" textTshepang Mbambo-72/+1
Only a single example is given
2023-07-30Rollup merge of #95965 - CAD97:const-weak-new, r=workingjubileeJubilee-2/+2
Stabilize const-weak-new This is a fairly uncontroversial library stabilization, so I'm going ahead and proposing it to ride the trains to stable. This stabilizes the following APIs, which are defined to be non-allocating constructors. ```rust // alloc::rc impl<T> Weak<T> { pub const fn new() -> Weak<T>; } // alloc::sync impl<T> Weak<T> { pub const fn new() -> Weak<T>; } ``` Closes #95091 ``@rustbot`` modify labels: +needs-fcp
2023-07-30Stabilize const-weak-newCAD97-2/+2
Bump its stabilization version several times along the way to accommodate changes in release processes. Co-authored-by: Mara Bos <m-ou.se@m-ou.se> Co-authored-by: Trevor Gross <t.gross35@gmail.com>
2023-07-30Avoid using ptr::Unique in LinkedList codeRyan Lowe-11/+13
2023-07-30Rollup merge of #114223 - ryanoneill:vec-indexing-doc-language, r=workingjubileeMatthias Krüger-1/+1
Documentation: Fix Stilted Language in Vec->Indexing Problem Language in the Vec->Indexing documentation sounds stilted due to incorrect word ordering: "... type allows to access values by index." Solution Reorder words in the Vec->Indexing documentation to flow better: "... type allows access to values by index." The phrase "allows access to" also matches other existing documentation.
2023-07-30Auto merge of #114236 - fee1-dead-contrib:rollup-m92j7q1, r=fee1-deadbors-0/+8
Rollup of 3 pull requests Successful merges: - #112151 (Clarify behavior of inclusive bounds in BTreeMap::{lower,upper}_bound) - #113512 (Updated lines doc to include trailing carriage return note) - #114203 (Effects: don't print `host` param in diagnostics) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-30Rollup merge of #112151 - chloekek:patch-1, r=workingjubileefee1-dead-0/+8
Clarify behavior of inclusive bounds in BTreeMap::{lower,upper}_bound It wasn’t quite clear to me how these methods would interpret inclusive bounds so I added examples for those.
2023-07-30Auto merge of #112280 - zica87:master, r=workingjubileebors-13/+0
Remove redundant example of `BTreeSet::iter` The usage and that `Values returned by the iterator are returned in ascending order` are already demonstrated by the other example and the description, so I removed the useless one.
2023-07-29Documentation: Fix Stilted Language in Vec->IndexingRyan O'Neill-1/+1
Problem Language in the Vec->Indexing documentation sounds stilted due to incorrect word ordering: "... type allows to access values by index." Solution Reorder words in the Vec->Indexing documentation to flow better: "... type allows access to values by index." The phrase "allows access to" also matches other existing documentation.
2023-07-28btree/map.rs: remove "Basic usage" textTshepang Mbambo-54/+0
Not useful, for there is just a single example
2023-07-28add LinkedList::{retain,retain_mut}TennyZhuang-0/+93
Signed-off-by: TennyZhuang <zty0826@gmail.com>
2023-07-25Add note that Vec::as_mut_ptr() does not materialize a reference to the ↵Manish Goregaokar-0/+35
internal buffer
2023-07-25Auto merge of #114020 - steffahn:hide-specialized-ToString-impls, r=thomccbors-0/+9
Hide `ToString` implementations that specialize the default one The status quo is highly confusing, since the overlap is not apparent, and specialization is not a feature of Rust. This change addresses #87545; I'm not certain if it closes/fixes it entirely, since that issue might also be tracking the question of a *general* solution for hiding the documentation for specializing impls automatically. Before ![Screenshot_20230724_234210](https://github.com/rust-lang/rust/assets/3986214/54bbe659-1790-4e95-a5d8-5426e710ceb8) After ![Screenshot_20230724_234255](https://github.com/rust-lang/rust/assets/3986214/ee645d6e-c1c0-40c0-a0d3-a5c5f3dae65e)
2023-07-24Implement `From<[T; N]>` for `Rc<[T]>` and `Arc<[T]>`Nikolai Vazquez-0/+42
2023-07-24remove additional [allow(unused_unsafe)]James Dietz-1/+0
2023-07-24Hide `ToString` implementations that specialize the default onesFrank Steffahn-0/+9
The status quo is highly confusing, since the overlap is not apparent, and specialization is not a feature of Rust. This addresses #87545; I'm not certain if it closes it, since that issue might also be trackign a *general* solution for hiding specializing impls automatically.
2023-07-22Auto merge of #113954 - matthiaskrgr:rollup-e2r9suz, r=matthiaskrgrbors-8/+8
Rollup of 6 pull requests Successful merges: - #112490 (Remove `#[cfg(all())]` workarounds from `c_char`) - #113252 (Update the tracking issue for `const_cstr_from_ptr`) - #113442 (Allow limited access to `OsString` bytes) - #113876 (fix docs & example for `std::os::unix::prelude::FileExt::write_at`) - #113898 (Fix size_hint for EncodeUtf16) - #113934 (Multibyte character removal in String::pop and String::remove doctests) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-22Auto merge of #113224 - zachs18:vec_extend_remove_allocator_lifetime, r=cuviperbors-3/+3
Remove lifetime bound for A for `impl Extend<&'a T> for Vec<T, A>`. The lifetime of the references being copied from is unrelated to the allocator. Compare with [`impl<'a, T: 'a + Copy, A: Allocator> Extend<&'a T> for VecDeque<T, A>`](https://doc.rust-lang.org/alloc/collections/vec_deque/struct.VecDeque.html#impl-Extend%3C%26'a+T%3E-for-VecDeque%3CT,+A%3E) which does not have the `A: 'a` bound already. Since `Allocator` is unstable, the only possible `A` on stable is `Global`, and `Global: 'static`, so this change is not (should not be) observable on stable (or without `#![feature(allocator_api)]`). [This is observable on nightly](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=8c4aa166c6116a90593d2934d30cfeb3).
2023-07-21Demonstrate multibyte character removal in String::pop and String::remove ↵Andrew Tribick-8/+8
doctests
2023-07-18std::error::Error -> Trait Implementations: lifetimes consistency improvementWiktorPrzetacznik-8/+8
2023-07-18Make {Rc,Arc}::allocator associated functionsMike Hommey-4/+12
2023-07-17Auto merge of #89132 - Cyborus04:rc_allocator_support, r=Amanieubors-300/+1518
Add support for allocators in `Rc` & `Arc` Adds the ability for `std::rc:Rc`, `std::rc::Weak`, `std::sync::Arc`, and `std::sync::Weak` to live in custom allocators
2023-07-16Implement `From<{&,&mut} [T; N]>` for `Vec<T>`EFanZh-0/+30
2023-07-14Rollup merge of #113662 - pedroclobo:vec-deque-rotate, r=thomccMatthias Krüger-25/+25
Rename VecDeque's `rotate_left` and `rotate_right` parameters This pull request introduces a modification to the `VecDeque` collection, specifically the `rotate_left` and `rotate_right` functions, by renaming the parameter associated with these functions. The rationale behind this change is to provide clearer and more consistent naming for the parameter that specifies the number of places to rotate the double-ended queue. By using `n` as the parameter name in both functions, it becomes easier to understand and remember the purpose of the parameter.