about summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2023-04-25Rollup merge of #110782 - matthiaskrgr:revert_panic_oom, r=AmanieuMatthias Krüger-1/+13
Revert panic oom This temporarily reverts https://github.com/rust-lang/rust/pull/109507 until https://github.com/rust-lang/rust/issues/110771 is addressed r? `@Amanieu`
2023-04-25Add shortcut for Grisu3 algorithm.mazong1123-0/+16
Check requested digit length and the fractional or integral parts of the number. Falls back earlier without trying the Grisu algorithm if the specific condition meets. Fix #110129
2023-04-24Auto merge of #106152 - SUPERCILEX:lazycell, r=Amanieubors-0/+28
Add LazyCell::into_inner This enables uses cases that need to extract the evaluated value and do something owned with it.
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-1/+13
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-24Restructure std::fmt::rt a bit.Mara Bos-200/+200
This moves more of the internal/lang items into the private rt module.
2023-04-24Remove "V1" from ArgumentsV1 and FlagsV1.Mara Bos-23/+23
2023-04-24Implement FusedIterator for DecodeUtf16 when the inner iterator doesColin Finck-0/+4
2023-04-24Rollup merge of #110706 - scottmcm:transmute_unchecked, r=oli-obkMatthias Krüger-19/+31
Add `intrinsics::transmute_unchecked` This takes a whole 3 lines in `compiler/` since it lowers to `CastKind::Transmute` in MIR *exactly* the same as the existing `intrinsics::transmute` does, it just doesn't have the fancy checking in `hir_typeck`. Added to enable experimenting with the request in <https://github.com/rust-lang/rust/pull/106281#issuecomment-1496648190> and because the portable-simd folks might be interested for dependently-sized array-vector conversions. It also simplifies a couple places in `core`. See also https://github.com/rust-lang/rust/pull/108442#issuecomment-1474777273, where `CastKind::Transmute` was added having exactly these semantics before the lang meeting (which I wasn't in) independently expressed interest.
2023-04-22Add `intrinsics::transmute_unchecked`Scott McMurray-19/+31
This takes a whole 3 lines in `compiler/` since it lowers to `CastKind::Transmute` in MIR *exactly* the same as the existing `intrinsics::transmute` does, it just doesn't have the fancy checking in `hir_typeck`. Added to enable experimenting with the request in <https://github.com/rust-lang/rust/pull/106281#issuecomment-1496648190> and because the portable-simd folks might be interested for dependently-sized array-vector conversions. It also simplifies a couple places in `core`.
2023-04-22Fix grammarCaleb Robson-2/+2
2023-04-22Auto merge of #109507 - Amanieu:panic-oom-payload, r=davidtwcobors-13/+1
Report allocation errors as panics OOM is now reported as a panic but with a custom payload type (`AllocErrorPanicPayload`) which holds the layout that was passed to `handle_alloc_error`. This should be review one commit at a time: - The first commit adds `AllocErrorPanicPayload` and changes allocation errors to always be reported as panics. - The second commit removes `#[alloc_error_handler]` and the `alloc_error_hook` API. ACP: https://github.com/rust-lang/libs-team/issues/192 Closes #51540 Closes #51245
2023-04-22Auto merge of #110666 - JohnTitor:rollup-3pwilte, r=JohnTitorbors-1/+1
Rollup of 7 pull requests Successful merges: - #109949 (rustdoc: migrate `document_type_layout` to askama) - #110622 (Stable hash tag (discriminant) of `GenericArg`) - #110635 (More `IS_ZST` in `library`) - #110640 (compiler/rustc_target: Raise m68k-linux-gnu baseline to 68020) - #110657 (nit: consistent naming for SimplifyConstCondition) - #110659 (rustdoc: clean up JS) - #110660 (Print ty placeholders pretty) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-04-22Rollup merge of #110635 - scottmcm:zst-checks, r=the8472Yuki Okushi-1/+1
More `IS_ZST` in `library` I noticed that `post_inc_start` and `pre_dec_end` were doing this check in different ways https://github.com/rust-lang/rust/blob/d19b64fb54391b64ce99981577c67c93ac2a9ffa/library/core/src/slice/iter/macros.rs#L76-L93 so started making this PR, then added a few more I found since I was already making changes anyway.
2023-04-22Auto merge of #106934 - DrMeepster:offset_of, r=WaffleLapkinbors-0/+42
Add offset_of! macro (RFC 3308) Implements https://github.com/rust-lang/rfcs/pull/3308 (tracking issue #106655) by adding the built in macro `core::mem::offset_of`. Two of the future possibilities are also implemented: * Nested field accesses (without array indexing) * DST support (for `Sized` fields) I wrote this a few months ago, before the RFC merged. Now that it's merged, I decided to rebase and finish it. cc `@thomcc` (RFC author)
2023-04-21More `IS_ZST` in `library`Scott McMurray-1/+1
I noticed that `post_inc_start` and `pre_dec_end` were doing this check in different ways https://github.com/rust-lang/rust/blob/d19b64fb54391b64ce99981577c67c93ac2a9ffa/library/core/src/slice/iter/macros.rs#L76-L93 so started making this PR, then added a few more I found since I was already making changes anyway.
2023-04-21Fix no_global_oom_handling buildArlo Siemsen-1/+0
`provide_sorted_batch` in core is incorrectly marked with `#[cfg(not(no_global_oom_handling))]` which prevents core from building with the cfg enabled. Nothing in core allocates memory including this function, so the `cfg` gate is incorrect.
2023-04-21minor tweaksDrMeepster-1/+1
2023-04-21offset_ofDrMeepster-0/+42
2023-04-20More `mem::take` in `library`Scott McMurray-4/+4
A bunch of places were using `replace(…, &mut [])`, but that can just be `take`.
2023-04-20Add reason to #![unstable] tag.Mara Bos-1/+1
Co-authored-by: jyn <github@jyn.dev>
2023-04-20Remove doc link to private item.Mara Bos-4/+2
2023-04-20Get rid of core::fmt::FormatSpec.Mara Bos-11/+6
2023-04-20Rename fmt::rt::Argument to Placeholder.Mara Bos-7/+6
2023-04-20Turn core::fmt::rt::v1 into a private module.Mara Bos-31/+24
2023-04-20Use fmt::Alignment instead of fmt::rt::v1::Alignment.Mara Bos-13/+13
2023-04-20Rollup merge of #110448 - ripytide:master, r=cuviperYuki Okushi-45/+46
cmp doc examples improvements Most changes are for stylistic consistency, with some changes to provide more clarity.
2023-04-20Implement `Neg` for signed non-zero integers.John Millikin-3/+16
Negating a non-zero integer currently requires unpacking to a primitive and re-wrapping. Since negation of non-zero signed integers always produces a non-zero result, it is safe to implement `Neg` for `NonZeroI{N}`. The new `impl` is marked as stable because trait implementations for two stable types can't be marked unstable.
2023-04-19Auto merge of #110393 - fee1-dead-contrib:rm-const-traits, r=oli-obkbors-1037/+528
Rm const traits in libcore See [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60const.20Trait.60.20removal.20or.20rework) * [x] Bless ui tests * [ ] Re constify some unstable functions with workarounds if they are needed
2023-04-19std: make `Debug` representations of `[Lazy, Once]*[Cell, Lock]` consistent ↵joboet-18/+10
with `Mutex` and `RwLock` `Mutex` prints `<locked>` as a field value when its inner value cannot be accessed, but the lazy types print a fixed string like "`OnceCell(Uninit)`". This could cause confusion if the inner type is a unit type named `Uninit` and does not respect the pretty-printing flag. With this change, the format message is now "`OnceCell(<uninit>)`", consistent with `Mutex`.
2023-04-19Rollup merge of #110432 - compiler-errors:unsatisfied-index-impl, r=cjgillotMatthias Krüger-0/+1
Report more detailed reason why `Index` impl is not satisfied Fixes #110373
2023-04-18Use a diagnostic item instead of filtering for Index::OutputMichael Goulet-0/+1
2023-04-18Rollup merge of #110441 - kadiwa4:typos, r=thomccGuillaume Gomez-6/+6
5 little typos
2023-04-17cmp doc examples consistency improvementsripytide-45/+46
2023-04-17fix codegen differenceDeadbeef-8/+22
2023-04-17typoskadiwa-6/+6
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-13/+1
2023-04-16Add a message indicating overflow inJohn Bobbo-1/+3
`core::intrinsics::is_nonoverlapping`.
2023-04-16readd `const_trait` to `Drop`, `Destruct`, and `Fn*`Deadbeef-0/+6
2023-04-16fix tidyDeadbeef-0/+3
2023-04-16core is now compilableDeadbeef-251/+85
2023-04-16more hacksDeadbeef-6/+14
2023-04-16hack cstr is_emptyDeadbeef-1/+2
2023-04-16hack signum as wellDeadbeef-2/+5
2023-04-16memchr hackDeadbeef-3/+8
2023-04-16rm const traits in libcoreDeadbeef-836/+453
2023-04-15Use a `saturating_mul` instead of a `checked_mul`John Bobbo-1/+1
and `unwrap` in `core::intrinsics`.
2023-04-16Rollup merge of #110347 - est31:size_of_links, r=jyn514Yuki Okushi-6/+13
Add intra-doc links to size_of_* functions Also some smaller doc improvements.
2023-04-15Add intra-doc links to size_of_* functionsest31-6/+13
2023-04-14Add Lazy{Cell,Lock}::into_innerAlex Saveau-0/+28
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2023-04-14Rollup merge of #110244 - kadiwa4:unnecessary_imports, r=JohnTitorMatthias Krüger-12/+1
Remove some unneeded imports / qualified paths Continuation of #105537.