about summary refs log tree commit diff
path: root/library/core/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-09-27Remove `cfg(bootstrap)` for `doc_cfg` feature following #141925Guillaume Gomez-49/+21
2025-09-27Remove `doc_cfg_hide` featureGuillaume Gomez-1/+1
2025-09-27Implement RFC 3631Guillaume Gomez-21/+48
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-0/+1
2025-09-08simplify the declaration of the legacy integer modules (`std::u32` etc.)cyrgani-41/+10
2025-09-04Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35Jacob Pratt-0/+1
Implement Integer funnel shifts Tracking issue: rust-lang/rust#145686 ACP: https://github.com/rust-lang/libs-team/issues/642 This implements funnel shifts on primitive integer types. Implements this for cg_llvm, with a fallback impl for everything else Thanks `@folkertdev` for the fixes and tests cc `@rust-lang/libs-api`
2025-09-03Add `funnel_sh{l,r}` functions and intrinsicssayantn-0/+1
- Add a fallback implementation for the intrinsics - Add LLVM backend support for funnel shifts Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-08-27Rollup merge of #145335 - clarfonthey:wtf8-core-alloc, r=Mark-SimulacrumMatthias Krüger-0/+2
Move WTF-8 code from std into core and alloc This is basically a small portion of rust-lang/rust#129411 with a smaller scope. It *does not*\* affect any public APIs; this code is still internal to the standard library. It just moves the WTF-8 code into `core` and `alloc` so it can be accessed by `no_std` crates like `backtrace`. > \* The only public API this affects is by adding a `Debug` implementation to `std::os::windows::ffi::EncodeWide`, which was not present before. This is due to the fact that `core` requires `Debug` implementations for all types, but `std` does not (yet) require this. Even though this was ultimately changed to be a wrapper over the original type, not a re-export, I decided to keep the `Debug` implementation so it remains useful. Like we do with ordinary strings, the tests are still located entirely in `alloc`, rather than splitting them into `core` and `alloc`. ---- Reviewer note: for ease of review, this is split into three commits: 1. Moving the original files into their new "locations" 2. Actually modifying the code to compile. 3. Removing aesthetic changes that were made so that the diff for commit 2 was readable. You can review commits 1 and 3 to verify these claims, but commit 2 contains the majority of the changes you should care about. ---- API changes: `impl Debug for std::os::windows::ffi::EncodeWide`
2025-08-21Introduce Reborrow lang item and traitAapo Alasuutari-0/+1
2025-08-20Move WTF-8 code from std to core/allocltdk-0/+2
2025-08-18Remove the `From` derive macro from preludeJakub Beránek-0/+7
To avoid backwards compatibility problems.
2025-08-15Rollup merge of #145322 - LorrensP-2158466:early-prelude-processing, ↵Stuart Cook-4/+4
r=petrochenkov Resolve the prelude import in `build_reduced_graph` This pr tries to resolve the prelude import at the `build_reduced_graph` stage. Part of batched import resolution in rust-lang/rust#145108 (cherry picked commit) and maybe needed for rust-lang/rust#139493. r? petrochenkov
2025-08-14resolve prelude import at `build_reduced_graph` phaseLorrensP-2158466-4/+4
2025-08-14Stabilize `sse4a` and `tbm` target featuressayantn-2/+0
- remove some stabilized target features from `gate.rs`
2025-08-07Rollup merge of #138689 - jedbrown:jed/nvptx-target-feature, r=ZuseZ4Stuart Cook-0/+1
add nvptx_target_feature Tracking issue: #141468 (nvptx), which is part of #44839 (catch-all arches) The feature gate is `#![feature(nvptx_target_feature)]` This exposes the target features `sm_20` through `sm_120a` [as defined](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.1/llvm/lib/Target/NVPTX/NVPTX.td#L59-L85) by LLVM. Cc: ``````@gonzalobg`````` ``````@rustbot`````` label +O-NVPTX +A-target-feature
2025-07-20Rollup merge of #143423 - hkBst:clippy-fix-1, r=workingjubileeGuillaume Gomez-3/+3
address clippy formatting nits - int_log10.rs: change top level doc comments to outer - collect.rs: remove empty line after doc comment - clippy fix: markdown indentation for indented items after line break: a markdown list item continued over multiples lines, but those following lines which are part of the same item are not indented - clippy fix: bound in one place: when there is a bound in angle brackets and another bound on the same variable in a where clause
2025-07-18Rollup merge of #143925 - oli-obk:slice-const-partialeq, r=fee1-deadMatthias Krüger-0/+2
Make slice comparisons const This needed a fix for `derive_const`, too, as it wasn't usable in libcore anymore as trait impls need const stability attributes. I think we can't use the same system as normal trait impls while `const_trait_impl` is still unstable. r? ```@fee1-dead``` cc rust-lang/rust#143800
2025-07-17Make slices `[const] PartialEq`Oli Scherer-0/+2
2025-07-12Fixed a core crate compilation failure when enabling the `optimize_for_size` ↵nazo6-0/+1
feature on some targets
2025-07-08collect.rs: remove empty line after doc commentMarijn Schouten-3/+3
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-25make `tidy-alphabetical` use a natural sortFolkert de Vries-1/+1
2025-06-21add nvptx_target_featureJed Brown-0/+1
Add target features for sm_* and ptx*, both of which form a partial order, but cannot be combined to a single partial order. These mirror the LLVM target features, but we do not provide LLVM target processors (which imply both an sm_* and ptx* feature). Add some documentation for the nvptx target.
2025-06-20Rollup merge of #142756 - Daniel-Aaron-Bloom:const-clone, r=oli-obkTrevor Gross-0/+1
Make `Clone` a `const_trait` See [tracking issue](https://github.com/rust-lang/rust/issues/142757) for justification.
2025-06-19Make `Clone` a `const_trait`Daniel Bloom-0/+1
2025-06-11stabilize gaiBoxy-1/+0
2025-06-10Rollup merge of #140766 - sayantn:stabilize-keylocker, r=traviscross,tgross35León Orell Valerian Liehr-1/+0
Stabilize keylocker This PR stabilizes the feature flag `keylocker_x86` (tracking issue rust-lang/rust#134813). # Public API The 2 `x86` target features `kl` and `widekl`, and the associated intrinsics in stdarch. These target features are very specialized, and are only used to signal the presence of the corresponding CPU instruction. They don't have any nontrivial interaction with the ABI (contrary to something like AVX), and serve the only purpose of enabling 11 stdarch intrinsics, all of which have been implemented and propagated to rustc via a stdarch submodule update. Also, these were added way back in LLVM12, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too! # Associated PRs - rust-lang/rust#134814 - rust-lang/stdarch#1706 - rust-lang/rust#136831 (stdarch submodule update) - rust-lang/stdarch#1795 (stabilizing the runtime detection and intrinsics) - rust-lang/rust#141964 (stdarch submodule update for the stabilization of the runtime detection and intrinsics) As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. cc ````@rust-lang/lang```` cc ````@rust-lang/libs-api```` for the intrinsics and runtime detection I don't think anyone else worked on this feature, so no one else to ping, maybe cc ````@Amanieu.```` I will send the reference pr soon.
2025-06-07Stabilize `sha512_sm_x86`, and the `sha512`, `sm3` and `sm4` target featuressayantn-1/+0
2025-06-07Stabilize the `keylocker_x86` flag, and the `kl` and `widekl` target featuressayantn-1/+0
2025-06-02Remove bootstrap cfgs from library/Josh Stone-2/+0
2025-05-28Rollup merge of #140697 - Sa4dUs:split-autodiff, r=ZuseZ4Trevor Gross-1/+2
Split `autodiff` into `autodiff_forward` and `autodiff_reverse` This PR splits `#[autodiff]` macro so `#[autodiff(df, Reverse, args)]` would become `#[autodiff_reverse(df, args)]` and `#[autodiff(df, Forward, args)]` would become `#[autodiff_forwad(df, args)]`.
2025-05-23Remove #![feature(let_chains)] from libcoreest31-1/+0
2025-05-21Disable autodiff bootstrappingMarcelo Domínguez-0/+1
2025-05-20Rename `cfg_match!` to `cfg_select!`Trevor Gross-3/+3
At [1] it was pointed out that `cfg_match!` syntax does not actually align well with match syntax, which is a possible source of confusion. The comment points out that usage is instead more similar to ecosystem `select!` macros. Rename `cfg_match!` to `cfg_select!` to match this. Tracking issue: https://github.com/rust-lang/rust/issues/115585 [1]: https://github.com/rust-lang/rust/issues/115585#issuecomment-2346307605
2025-05-20Split `autodiff` into `autodiff_forward` and `autodiff_reverse`Marcelo Domínguez-1/+1
Pending fix. ``` error: cannot find a built-in macro with name `autodiff_forward` --> library\core\src\macros\mod.rs:1542:5 | 1542 | / pub macro autodiff_forward($item:item) { 1543 | | /* compiler built-in */ 1544 | | } | |_____^ error: cannot find a built-in macro with name `autodiff_reverse` --> library\core\src\macros\mod.rs:1549:5 | 1549 | / pub macro autodiff_reverse($item:item) { 1550 | | /* compiler built-in */ 1551 | | } | |_____^ error: could not compile `core` (lib) due to 2 previous errors ```
2025-05-18Auto merge of #127013 - tgross35:f16-format-parse, r=Mark-Simulacrumbors-0/+1
Add `f16` formatting and parsing Use the same algorithms as for `f32` and `f64` to implement `f16` parsing and printing. try-job: x86_64-gnu-aux
2025-05-18Rollup merge of #138940 - sayantn:stabilize-avx512, r=Amanieu,traviscrossLeón Orell Valerian Liehr-1/+1
Stabilize the avx512 target features This PR stabilizes the AVX512 target features - see [this comment](https://github.com/rust-lang/rust/issues/111137#issuecomment-2745821279). Tracking Issue - #44839 The target feature UI tests have been changed to `x87` (chosen because this is very unlikely to stablize ever, please comment if some other feature will be better) related: #111137
2025-05-18float: Add `f16` parsing and printingTrevor Gross-0/+1
Use the existing Lemire (decimal -> float) and Dragon / Grisu algorithms (float -> decimal) to add support for `f16`. This allows updating the implementation for `Display` to the expected behavior for `Display` (currently it prints the a hex bitwise representation), matching other floats, and adds a `FromStr` implementation. In order to avoid crashes when compiling with Cranelift or on targets where f16 is not well supported, a fallback is used if `cfg(target_has_reliable_f16)` is not true.
2025-05-18Stabilize `avx512_target_feature`sayantn-1/+1
2025-04-30Stabilize `#![feature(non_null_from_ref)]`Mathis B-1/+0
2025-04-28Rollup merge of #139656 - scottmcm:stabilize-slice-as-chunks, r=dtolnayChris Denton-1/+0
Stabilize `slice_as_chunks` library feature ~~Draft as this needs #139163 to land first.~~ FCP: https://github.com/rust-lang/rust/issues/74985#issuecomment-2769963395 Methods being stabilized are: ```rust impl [T] { const fn as_chunks<const N: usize>(&self) -> (&[[T; N]], &[T]); const fn as_rchunks<const N: usize>(&self) -> (&[T], &[[T; N]]); const unsafe fn as_chunks_unchecked<const N: usize>(&self) -> &[[T; N]]; const fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[T; N]], &mut [T]); const fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [T], &mut [[T; N]]); const unsafe fn as_chunks_unchecked_mut<const N: usize>(&mut self) -> &mut [[T; N]]; } ``` ~~(FCP's not done quite yet, but will in another day if I'm counting right.)~~ FCP Complete: https://github.com/rust-lang/rust/issues/74985#issuecomment-2797951535
2025-04-15Auto merge of #139632 - Darksonn:cfi-fmt, r=m-ou-sebors-1/+0
cfi: do not transmute function pointers in formatting code Follow-up to #115954. Addresses #115199 point 2. Related to #128728. Discussion [on the LKML](https://lore.kernel.org/all/20250410115420.366349-1-panikiel@google.com/). cc `@maurer` `@rcvalle` `@RalfJung`
2025-04-15Remove #![feature(no_sanitize)]Tamir Duberstein-1/+0
2025-04-15Rollup merge of #138374 - celinval:issue-136925-const-contract, ↵Stuart Cook-1/+0
r=compiler-errors,oli-obk,RalfJung Enable contracts for const functions Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions. This commit also removes one level of indirection for ensures clauses since we no longer build a closure around the ensures predicate. Resolves #136925 **Call-out:** This is still a draft PR since CI is broken due to a new warning message for unreachable code when the bottom of the function is indeed unreachable. It's not clear to me why the warning wasn't triggered before. r? ```@compiler-errors```
2025-04-13Initial `UnsafePinned`/`UnsafeUnpin` impl [Part 1: Libs]Sky-0/+1
2025-04-10Stabilize `slice_as_chunks` library featureScott McMurray-1/+0
2025-04-07Enable contracts for const functionsCelina G. Val-1/+0
Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions. This commit also removes one level of indirection for ensures clauses, however, it currently has a spurious warning message when the bottom of the function is unreachable.
2025-03-26Use cfg_match in coreChristopher Durham-0/+1
2025-03-16Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc许杰友 Jieyou Xu (Joe)-17/+0
Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-11Migrate core to Rust 2024Eric Huss-1/+1