about summary refs log tree commit diff
path: root/library/core
AgeCommit message (Collapse)AuthorLines
2023-04-27pub -> pub(super).Mara Bos-1/+1
2023-04-27Implement `StructuralEq` for integers, `bool` and `char`Maybe Waffle-0/+29
(how did this work before??)
2023-04-27Auto merge of #110562 - ComputerDruid:riscv, r=tmandrybors-1/+4
Add definitions for riscv64gc-unknown-fuchsia To compile, also requires a libc update with https://github.com/rust-lang/libc/pull/3204
2023-04-26Rollup merge of #110819 - tamird:flattencompat-trustedlen, r=the8472Matthias Krüger-34/+28
simplify TrustedLen impls Implement on FlattenCompat and delegate from Flatten and FlatMap. /cc ``@the8472``
2023-04-26Rollup merge of #110419 - jsoref:spelling-library, r=jyn514Matthias Krüger-14/+14
Spelling library Split per https://github.com/rust-lang/rust/pull/110392 I can squash once people are happy w/ the changes. It's really uncommon for large sets of changes to be perfectly acceptable w/o at least some changes. I probably won't have time to respond until tomorrow or the next day
2023-04-26Implement midpoint for all unsigned NonZeroU{8,16,32,64,128,size}Loïc BRANSTETT-0/+37
2023-04-26Implement midpoint for all floating point f32 and f64Loïc BRANSTETT-3/+125
2023-04-26Implement midpoint for all signed and unsigned integersLoïc BRANSTETT-0/+151
2023-04-26Rollup merge of #108416 - pat-nel87:Issue-107957-black_box_docs, r=jyn514jyn-6/+3
black_box doc corrections for clarification - Issue #107957 Made a complete pass through the docs to help resolve https://github.com/rust-lang/rust/issues/107957 No code changes, just documentation `@rustbot` label +T-libs-api -T-libs
2023-04-26Spelling library/Josh Soref-14/+14
* advance * aligned * borrowed * calculate * debugable * debuggable * declarations * desugaring * documentation * enclave * ignorable * initialized * iterator * kaboom * monomorphization * nonexistent * optimizer * panicking * process * reentrant * rustonomicon * the * uninitialized Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-25Add definitions for riscv64gc-unknown-fuchsiaDan Johnson-1/+4
2023-04-25Rollup merge of #110649 - arlosi:fix_no_global_oom_handling, r=Mark-SimulacrumMatthias Krüger-1/+0
Fix no_global_oom_handling build `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). The `cfg` gate is incorrect. cc ``@dpaoliello`` r? ``@wesleywiser`` The cfg was added by #107191
2023-04-25simplify TrustedLen implsTamir Duberstein-34/+28
Implement on FlattenCompat and delegate from Flatten and FlatMap.
2023-04-25Auto merge of #110389 - mazong1123:add-shortcut-for-grisu3, r=Mark-Simulacrumbors-0/+43
Add shortcut for Grisu3 algorithm. While Grisu3 is way more faster for most numbers compare to Dragon4, the fall back to Dragon4 procedure for certain numbers could cause some performance regressions compare to use Dragon4 directly. Mitigating the regression caused by falling back is important for a largely used core library. In Grisu3 algorithm implementation, there's a shortcut to jump out earlier when the fractional or integrals cannot meet the requirement of requested digits. This could significantly improve the performance of converting floating number to string as it falls back even without starting trying the algorithm. The original idea is from the [.NET implementation](https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Number.Grisu3.cs#L602-L615) and the code was originally added in [this PR](https://github.com/dotnet/coreclr/pull/14646#issuecomment-350942050). This shortcut has been shipped long time ago and has been proved working. Fix #110129
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/+43
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/+233
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-21major test improvementsDrMeepster-14/+109
2023-04-21minor tweaksDrMeepster-1/+1
2023-04-21fmtDrMeepster-1/+1
2023-04-21fix incorrect param env in dead code lintDrMeepster-1/+1
2023-04-21test improvementsDrMeepster-0/+21
2023-04-21offset_ofDrMeepster-0/+117
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/+34
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-1063/+591
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