summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2022-08-05Revert write! and writeln! to late drop temporariesDavid Tolnay-8/+6
2022-06-22Rollup merge of #97516 - RalfJung:atomics, r=joshtriplettYuki Okushi-0/+7
clarify how Rust atomics correspond to C++ atomics ``@cbeuw`` noted in https://github.com/rust-lang/miri/pull/1963 that the correspondence between C++ atomics and Rust atomics is not quite as obvious as one might think, since in Rust I can use `get_mut` to treat previously non-atomic data as atomic. However, I think using C++20 `atomic_ref`, we can establish a suitable relation between the two -- or do you see problems with that ``@cbeuw?`` (I recall you said there was some issue, but it was deep inside that PR and Github makes it impossible to find...) Cc ``@thomcc;`` not sure whom else to ping for atomic memory model things.
2022-06-21hedge our betsRalf Jung-1/+1
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2022-06-21Rollup merge of #97269 - RalfJung:transmute, r=m-ou-seYuki Okushi-1/+1
adjust transmute const stabilization version With 1.46, this became callable only in `const`/`static` items. Only since 1.56 is this callable in `const fn`: [changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1560-2021-10-21) Also see [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/transmute.20const.20fn.20stabilization).
2022-06-20Auto merge of #98307 - matthiaskrgr:rollup-rb3huha, r=matthiaskrgrbors-1/+3
Rollup of 4 pull requests Successful merges: - #98235 (Drop magic value 3 from code) - #98267 (Don't omit comma when suggesting wildcard arm after macro expr) - #98276 (Mention formatting macros when encountering `ArgumentV1` method in const) - #98296 (Add a link to the unstable book page on Generator doc comment) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-20Rollup merge of #98296 - JohnTitor:generator-unstable-book-link, r=Dylan-DPCMatthias Krüger-1/+2
Add a link to the unstable book page on Generator doc comment This makes it easier to jump into the Generator section on the unstable book. Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-20Rollup merge of #98276 - compiler-errors:const-format-macro, r=oli-obkMatthias Krüger-0/+1
Mention formatting macros when encountering `ArgumentV1` method in const Also open to just closing this if it's overkill. There are a lot of other distracting error messages around, so maybe it's not worth fixing just this one. Fixes #93665
2022-06-20Auto merge of #93765 - zhangyunhao116:heapsort, r=m-ou-sebors-8/+11
Optimize heapsort The new implementation is about 10% faster than the previous one(sorting random 1000 items).
2022-06-20Add a link to the unstable book page on Generator doc commentYuki Okushi-1/+2
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-06-20Rollup merge of #96719 - mbartlett21:patch-4, r=Dylan-DPCDylan DPC-3/+4
Fix the generator example for `pin!()` The previous generator example is not actually self-referential, since the reference is created after the yield. CC #93178 (tracking issue)
2022-06-20Rollup merge of #93080 - SkiFire13:itermut-as_mut_slice, r=m-ou-seDylan DPC-0/+48
Implement `core::slice::IterMut::as_mut_slice` and `impl<T> AsMut<[T]> for IterMut<'_, T>` As per [the zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/.60std.3A.3Aslice.3A.3AIterMut.3A.3Aas_mut_slice.60), the `AsMut` impl has been commented out, with a comment near the `#[unstable(...)]` to uncomment it when `as_mut_slice` gets stabilized.
2022-06-20Optimize heapsortzhangyunhao-8/+11
2022-06-20Show #![feature] in example.Mara Bos-1/+1
2022-06-19Mention formatting macros when encountering ArgumentV1::new in constMichael Goulet-0/+1
2022-06-20Rollup merge of #98257 - kadiwa4:into_future_doc_typos, r=Dylan-DPCYuki Okushi-2/+2
Fix typos in `IntoFuture` docs
2022-06-20Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplettYuki Okushi-0/+22
Add `core::mem::copy` to complement `core::mem::drop`. This is useful for combinators. I didn't add `clone` since you can already use `Clone::clone` in its place; copy has no such corresponding function.
2022-06-19Add `core::mem::copy` to complement `core::mem::drop`.Joshua Nelson-0/+22
This is useful for combinators. I didn't add `clone` since you can already use `Clone::clone` in its place; copy has no such corresponding function.
2022-06-19typos in `IntoFuture` docsKaDiWa4-2/+2
2022-06-19Auto merge of #97367 - WaffleLapkin:stabilize_checked_slice_to_str_conv, ↵bors-5/+6
r=dtolnay Stabilize checked slice->str conversion functions This PR stabilizes the following APIs as `const` functions in Rust 1.63: ```rust // core::str pub const fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error>; impl Utf8Error { pub const fn valid_up_to(&self) -> usize; pub const fn error_len(&self) -> Option<usize>; } ``` Note that the `from_utf8_mut` function is not stabilized as unique references (`&mut _`) are [unstable in const context]. FCP: https://github.com/rust-lang/rust/issues/91006#issuecomment-1134593095 [unstable in const context]: https://github.com/rust-lang/rust/issues/57349
2022-06-19Rollup merge of #98165 - WaffleLapkin:once_things_renamings, r=m-ou-seMatthias Krüger-388/+395
once cell renamings This PR does the renamings proposed in https://github.com/rust-lang/rust/issues/74465#issuecomment-1153703128 - Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}` - Move/rename `lazy::{SyncOnceCell, SyncLazy}` to `sync::{OnceLock, LazyLock}` (I used `Lazy...` instead of `...Lazy` as it seems to be more consistent, easier to pronounce, etc) ```@rustbot``` label +T-libs-api -T-libs
2022-06-18Expose iter::ByRefSized as unstable feature and use itPaolo Barbolini-3/+10
2022-06-17Rollup merge of #97675 - nvzqz:unsized-needs-drop, r=dtolnayYuki Okushi-2/+2
Make `std::mem::needs_drop` accept `?Sized` This change attempts to make `needs_drop` work with types like `[u8]` and `str`. This enables code in types like `Arc<T>` that was not possible before, such as https://github.com/rust-lang/rust/pull/97676.
2022-06-16Move/rename `lazy::{OnceCell, Lazy}` to `cell::{OnceCell, LazyCell}`Maybe Waffle-388/+395
2022-06-16Auto merge of #97842 - notriddle:notriddle/tuple-docs, r=jsha,GuillaumeGomezbors-94/+221
Improve the tuple and unit trait docs * Reduce duplicate impls; show only the `(T,)` and include a sentence saying that there exists ones up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`. Here's the new version: * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.tuple.html> * <https://notriddle.com/notriddle-rustdoc-test/std/primitive.unit.html>
2022-06-16Rollup merge of #98059 - tmiasko:inline-const-eval-select, r=AmanieuYuki Okushi-0/+1
Inline `const_eval_select` To avoid circular link time dependency between core and compiler builtins when building with `-Zshare-generics`. r? ```@Amanieu```
2022-06-14rustdoc: change "variadic tuple" notation to look less like real syntaxMichael Howell-4/+4
2022-06-13Horizon OS STD supportMeziu-1/+2
Co-authored-by: Ian Chamberlain <ian.h.chamberlain@gmail.com> Co-authored-by: Mark Drobnak <mark.drobnak@gmail.com>
2022-06-13Inline `const_eval_select`Tomasz Miąsko-0/+1
To avoid circular link time dependency between core and compiler builtins when building with `-Zshare-generics`.
2022-06-13Document an edge case of `str::split_once`Imbolc-0/+1
2022-06-12Rollup merge of #97950 - eggyal:issue-97945, r=Dylan-DPCMichael Goulet-2/+2
Clarify `#[derive(PartialEq)]` on enums Fixes #97945
2022-06-12Rollup merge of #97992 - m-ou-se:stabilize-scoped-threads, r=joshtriplettDylan DPC-6/+6
Stabilize scoped threads. Tracking issue: https://github.com/rust-lang/rust/issues/93203 FCP finished here: https://github.com/rust-lang/rust/issues/93203#issuecomment-1152249466
2022-06-11Add docs to `maybe_tuple_doc!`Michael Howell-0/+2
2022-06-11Update library/core/src/primitive_docs.rsMichael Howell-1/+1
2022-06-11Auto merge of #97996 - matthiaskrgr:rollup-bvbjlid, r=matthiaskrgrbors-3/+3
Rollup of 5 pull requests Successful merges: - #97904 (Small grammar fix in the compile_error documentation) - #97943 (line 1352, change `self` to `*self`, other to `*other`) - #97969 (Make -Cpasses= only apply to pre-link optimization) - #97990 (Add more eslint checks) - #97994 (feat(fix): update some links in `hir.rs`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-06-11docs: make all the variadic impls use `(T, ...)` exactlyMichael Howell-14/+14
2022-06-11Add test case for #trait-implementations-1 linkMichael Howell-0/+2
2022-06-11Re-add explicit list of traits to tuple docs, with limit notesMichael Howell-5/+34
2022-06-11Use relative path for addressing things in rust-lang/rustMichael Howell-2/+2
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-5/+5
2022-06-11Rollup merge of #97943 - Warrenren:master, r=Dylan-DPCMatthias Krüger-1/+1
line 1352, change `self` to `*self`, other to `*other` The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
2022-06-11Rollup merge of #97904 - est31:master, r=Dylan-DPCMatthias Krüger-2/+2
Small grammar fix in the compile_error documentation
2022-06-11Stabilize scoped threads.Mara Bos-6/+6
2022-06-10Fix typos in Provider API docsBenjamin Herr-2/+2
2022-06-11Update cmp.rsWarrenren-1/+1
line 1352, delete parentheses for reviewers asking for it.
2022-06-10Rollup merge of #97940 - GuillaumeGomez:relative-link, r=Dylan-DPCMatthias Krüger-2/+2
Use relative links instead of linking to doc.rust-lang.org when possible Part of https://github.com/rust-lang/rust/issues/97918.
2022-06-10Clarify `#[derive(PartialEq)]` on enumsAlan Egerton-2/+2
Fixes #97945
2022-06-10line 1352, change self to (*self), other to (*other)Warrenren-1/+1
The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know.
2022-06-10Use relative links instead of linking to doc.rust-lang.org when possibleGuillaume Gomez-2/+2
2022-06-10Rollup merge of #97876 - yoshuawuyts:into-future-docs, r=JohnTitor,yaahcYuki Okushi-0/+119
update docs for `std::future::IntoFuture` Ref https://github.com/rust-lang/rust/issues/67644. This updates the docs for `IntoFuture` providing a bit more guidance on how to use it. Thanks!
2022-06-10Auto merge of #91970 - nrc:provide-any, r=scottmcmbors-3/+373
Add the Provider api to core::any This is an implementation of [RFC 3192](https://github.com/rust-lang/rfcs/pull/3192) ~~(which is yet to be merged, thus why this is a draft PR)~~. It adds an API for type-driven requests and provision of data from trait objects. A primary use case is for the `Error` trait, though that is not implemented in this PR. The only major difference to the RFC is that the functionality is added to the `any` module, rather than being in a sibling `provide_any` module (as discussed in the RFC thread). ~~Still todo: improve documentation on items, including adding examples.~~ cc `@yaahc`