about summary refs log tree commit diff
path: root/library/core/src
AgeCommit message (Collapse)AuthorLines
2025-09-16Iterator repeat: no infinite loop for `last` and `count`Marijn Schouten-3/+4
2025-09-16Auto merge of #146614 - Zalathar:rollup-hcxvdi1, r=Zalatharbors-45/+13
Rollup of 9 pull requests Successful merges: - rust-lang/rust#145095 (Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_`) - rust-lang/rust#145960 (Split `FnCtxt::report_args_error` into subfunctions) - rust-lang/rust#146402 (interpret: fix overlapping aggregate initialization) - rust-lang/rust#146466 (llvm-wrapper: other cleanup) - rust-lang/rust#146574 (compiletest: Enable new-output-capture by default) - rust-lang/rust#146599 (replace some `#[const_trait]` with `const trait`) - rust-lang/rust#146601 (compiletest: Make `./x test --test-args ...` work again) - rust-lang/rust#146608 (improve internal bootstrap docs) - rust-lang/rust#146609 (bootstrap: lower verbosity of cargo to one less than bootstrap's) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-16Rollup merge of #146599 - npmccallum:cleanup, r=fmeaseStuart Cook-6/+3
replace some `#[const_trait]` with `const trait`
2025-09-16Rollup merge of #145095 - tiif:unstable_const_param, r=BoxyUwUStuart Cook-39/+10
Migrate `UnsizedConstParamTy` to unstable impl of `ConstParamTy_` Now that we have ``#[unstable_feature_bound]``, we can remove ``UnsizedConstParamTy`` that was meant to be an unstable impl of stable type and ``ConstParamTy_`` trait. r? `@BoxyUwU`
2025-09-15Rollup merge of #146533 - Zalathar:array-default, r=compiler-errorsMatthias Krüger-0/+5
Note some previous attempts to change the Default impl for `[T; 0]` Recently, rust-lang/rust#145457 experimented with changing the Default impl for `[T; 0]`. Subsequently, rust-lang/rust#146531 also aimed to perform a similar experiment. It seems like a good idea to add some links to the relevant source code, so that the historical context of this tricky topic is easier to find.
2025-09-15fix: Move CoerceShared into opsAapo Alasuutari-9/+13
2025-09-15Introduce CoerceShared lang item and traitAapo Alasuutari-0/+9
2025-09-15replace some `#[const_trait]` with `const trait`Nathaniel McCallum-6/+3
2025-09-15Remove UnsizedConstParamTy trait and make it into an unstable impltiif-39/+10
2025-09-15Rollup merge of #146284 - Kivooeo:blazing-fast-division-bignum, ↵Matthias Krüger-37/+0
r=Mark-Simulacrum Remove `div_rem` from `core::num::bignum` This fixes very old fixme that sounds like this ``` Stupid slow base-2 long division taken from https://en.wikipedia.org/wiki/Division_algorithm FIXME use a greater base ($ty) for the long division. ``` By deleting this method since it was never used
2025-09-14Note some previous attempts to change the Default impl for `[T; 0]`Zalathar-0/+5
2025-09-13initial implementation of the darwin_objc unstable featureJo Bates-0/+157
2025-09-13Rollup merge of #146521 - folkertdev:document-va-arg-safe, r=workingjubileeJacob Pratt-6/+23
document `core::ffi::VaArgSafe` tracking issue: https://github.com/rust-lang/rust/issues/44930 A modification of https://github.com/rust-lang/rust/pull/146454, keeping just the documentation changes, but not unsealing the trait. Although conceptually we'd want to unseal the trait, there are many edge cases to supporting arbitrary types. We'd need to exhaustively test that all targets/calling conventions support all types that rust might generate (or generate proper error messages for unsupported cases). At present, many of the `va_arg` implementations assume that the argument is a scalar, and has an alignment of at most 8. That is totally sufficient for an MVP (accepting all of the "standard" C types), but clearly does not cover all rust types. This PR also adds some various other tests for edge cases of c-variadic: - the `#[inline]` attribute in its various forms. At present, LLVM is unable to inline c-variadic functions, but the attribute should still be accepted. `#[rustc_force_inline]` already rejects c-variadic functions. - naked functions should accept and work with a C variable argument list. In the future we'd like to allow more ABIs with naked functions (basically, any ABI for which we accept defining foreign c-variadic functions), but for now only `"C"` and `"C-unwind` are supported - guaranteed tail calls: c-variadic functions cannot be tail-called. That was already rejected, but there was not test for it. r? `@workingjubilee`
2025-09-13c-variadic: document `core::ffi::VaArgSafe`Folkert de Vries-6/+23
and document `VaList::arg`.
2025-09-12Constify Eq, Ord, PartialOrdEvgenii Zheltonozhskii-103/+216
2025-09-11Rollup merge of #142315 - lolbinarycat:core-dedup-ptr-docs-139190-pt3, ↵Stuart Cook-134/+111
r=workingjubilee core::ptr: deduplicate docs for as_ref, addr, and as_uninit_ref also add INFO.md file explaining the purpose of the ptr/docs dir, and give some pointers (heh) to future maintainers. follow up to rust-lang/rust#142101 part of rust-lang/rust#139190 r? `@workingjubilee`
2025-09-10core::ptr: deduplicate docs for as_ref, addr, and as_uninit_refbinarycat-134/+111
also add INFO.md file explaining the purpouse of the ptr/docs dir.
2025-09-10Rollup merge of #144765 - Qelxiros:range-inclusive-last, r=jhprattMatthias Krüger-26/+169
inclusive `Range`s: change `end` to `last` Tracking issue: rust-lang/rust#125687 ACP: rust-lang/libs-team#511
2025-09-09Rollup merge of #146326 - cyrgani:int-module-1, r=jhprattStuart Cook-219/+81
simplify the declaration of the legacy integer modules (`std::u32` etc.) This PR removes some duplicated code from the declaration of the legacy integer modules by expanding the macro which is already used to generate `MIN` and `MAX` to now generate the whole module. This would also make the remaining steps listed in rust-lang/rust#68490 such as fully deprecating the modules or placing `#[doc(hidden)]` on them easier.
2025-09-09Rollup merge of #146324 - RalfJung:no-ptr-fragment, r=oli-obkStuart Cook-1/+37
const-eval: disable pointer fragment support This fixes https://github.com/rust-lang/rust/issues/146291 by disabling pointer fragment support for const-eval. I want to properly fix this eventually, but won't get to it in the next few weeks, so this is an emergency patch to prevent the buggy implementation from landing on stable. The beta cutoff is on Sep 12th so if this PR lands after that, we'll need a backport.
2025-09-09Rollup merge of #146314 - cyrgani:hide-fmt-args-nl, r=GuillaumeGomezStuart Cook-0/+1
mark `format_args_nl!` as `#[doc(hidden)]` The `#[unstable]` attribute of the macro already says: > `format_args_nl` is only for internal language use and is subject to change It does seem plausible to hide it from the `std` docs accordingly. The PR also removes the single usage of the macro outside of `std` as it does not seem like the macro is actually needed there.
2025-09-09Rollup merge of #146300 - bjoernager:f16-f128-sum-product, r=jhprattStuart Cook-1/+1
Implement `Sum` and `Product` for `f16` and `f128`. Tracking issue: rust-lang/rust#116909. This PR implements `core::iter::{Sum, Product}` for `f16` and `f128`. I'm curious as to why these two traits aren't already implemented. I've been unable to find any information about it at all, so if there is anything that currently blocks them, I would appreciate if someone could fill me in.
2025-09-08change end to lastJeremy Smart-26/+169
2025-09-08simplify the declaration of the legacy integer modules (`std::u32` etc.)cyrgani-219/+81
2025-09-08Rollup merge of #146319 - justinyaodu:patch-1, r=jhprattMatthias Krüger-1/+1
Fix typo in default.rs This sentence currently reads: > Rust implements `Default` for various primitives types. I think it should just be "primitive types".
2025-09-08mark `format_args_nl!` as `#[doc(hidden)]`cyrgani-0/+1
2025-09-08const-eval: disable pointer fragment supportRalf Jung-1/+37
2025-09-08Auto merge of #146173 - Kmeakin:km/unicode-data/no-ascii, r=jhprattbors-244/+313
Don't include ASCII characters in Unicode tables Split off from https://github.com/rust-lang/rust/pull/145219
2025-09-07Fix typo in default.rsJustin Yao Du-1/+1
2025-09-07remove unsused div_rem method from bignumKivooeo-37/+0
2025-09-07Implement 'Sum' and 'Product' for 'f16' and 'f128';Gabriel Bjørnager Jensen-1/+1
2025-09-07optimization: Don't include ASCII characters in Unicode tablesKarl Meakin-244/+313
The ASCII subset of Unicode is fixed and will never change, so we don't need to generate tables for it with every new Unicode version. This saves a few bytes of static data and speeds up `char::is_control` and `char::is_grapheme_extended` on ASCII inputs. Since the table lookup functions exported from the `unicode` module will give nonsensical errors on ASCII input (and in fact will panic in debug mode), I had to add some private wrapper methods to `char` which check for ASCII-ness first.
2025-09-07Auto merge of #146216 - ↵bors-3/+3
LorrensP-2158466:miri-float-nondet-foreign-items-take2, r=RalfJung Miri: non-deterministic floating point operations in foreign_items Take 2 of rust-lang/rust#143906. The last 2 commits are what changed compared to the original pr. Verified the tests using (fish shell): ```fish env MIRIFLAGS="-Zmiri-max-extra-rounding-error -Zmiri-many-seeds" ./x miri --no-fail-fast std core coretests -- f32 f64 ``` r? `@RalfJung`
2025-09-06Change stdlib float tests to account for miri nondet floats.LorrensP-2158466-3/+3
2025-09-06Rollup merge of #145940 - pascaldekloe:int-exp-tune, r=tgross35Trevor Gross-176/+213
single buffer for exponent fmt of integers No need for fragmented buffers when formatting. ``` orig.txt: fmt::write_i128_exp 143.39ns/iter +/- 0.32 orig.txt: fmt::write_i64_exp 68.72ns/iter +/- 0.03 new.txt: fmt::write_i128_exp 138.29ns/iter +/- 0.50 new.txt: fmt::write_i64_exp 58.93ns/iter +/- 4.62 ``` This patch fully eliminates unsafe pointer use (after rust-lang/rust#135265 and rust-lang/rust#136594). r? libs
2025-09-06clean up some old const trait impl syntaxNathaniel McCallum-106/+55
2025-09-05Rollup merge of #146234 - hkBst:file-generated-header, r=tgross35León Orell Valerian Liehr-1/+1
change file-is-generated doc comment to inner Alternatively this could perhaps be better as a normal comment...
2025-09-05Rollup merge of #146225 - Jules-Bertholet:simplify-float-midpoint, r=tgross35León Orell Valerian Liehr-32/+0
Simplify `{f16, f32, f64, f128}::midpoint()` `(float_ty::MAX / 2) - (float_ty::MIN_POSITIVE * 2)` equals `(float_ty::MAX / 2) + (float_ty::MIN_POSITIVE * 2)` equals `(float_ty::MAX / 2)`. So these branches are pointless. CC `@Urgau` who wrote the original implementation in https://github.com/rust-lang/rust/pull/92048; does this seem right? `@rustbot` label A-floating-point
2025-09-05single buffer for exponent fmt of integersPascal S. de Kloe-176/+213
2025-09-05change file-is-generated doc comment to innerMarijn Schouten-1/+1
2025-09-05Simplify `{f16, f32, f54, f128}::midpoint()`Jules Bertholet-32/+0
`(float_ty::MAX / 2) - (float_ty::MIN_POSITIVE * 2)` equals `(float_ty::MAX / 2) + (float_ty::MIN_POSITIVE * 2)` equals `(float_ty::MAX / 2)`. So these branches are pointless
2025-09-05Rollup merge of #144342 - Qelxiros:exact-bitshifts, r=tgross35Trevor Gross-0/+231
add exact bitshifts Tracking issue: rust-lang/rust#144336 cc ```@lolbinarycat```
2025-09-04Rollup merge of #145690 - sayantn:integer-funnel-shift, r=tgross35Jacob Pratt-0/+226
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-04Rollup merge of #146136 - ↵Stuart Cook-2/+5
AudaciousAxiom:docs/missing-closing-code-block-fences, r=tgross35 docs(std): add missing closing code block fences in doc comments This PR adds a few closing code block fences which I believe are missing in some doc comments. It seems that rustdoc just autocloses code blocks at the end of doc comments and thus these were easily overlooked: I do not think these code blocks are special in any way. I found these when working on a Clippy lint that checks the last sentence of doc comments for terminal punctuation, and these were failing cases when testing against the std. Therefore I am not entirely sure these are all such cases, but still have high hopes that they are (or at least a well-defined subset of them).
2025-09-04Rollup merge of #146054 - joboet:array-repeat-must_use, r=ibraheemdevStuart Cook-0/+1
add `#[must_use]` to `array::repeat`
2025-09-04Rollup merge of #143725 - kennytm:peekable_next_if_map, r=jhprattStuart Cook-0/+102
core: add Peekable::next_if_map Implementation for rust-lang/rust#143702
2025-09-03Rollup merge of #145414 - Kmeakin:km/unicode-table-refactors, ↵Stuart Cook-4/+16
r=joshtriplett,tgross35 unicode-table-generator refactors Split off from https://github.com/rust-lang/rust/pull/145219
2025-09-03Rollup merge of #145279 - clarfonthey:const-convert-initial, r=tgross35Stuart Cook-150/+237
Constify conversion traits (part 1) This is the first part of rust-lang/rust#144289 being split into smaller pieces. It adds/moves constness of several traits under the `const_convert` feature: * `From` * `Into` * `TryFrom` * `TryInto` * `FromStr` * `AsRef` * `AsMut` * `Borrow` * `BorrowMut` * `Deref` * `DerefMut` There are a few methods that are intrinsically tied to these traits which I've included in the feature. Particularly, those which are wrappers over `AsRef`: * `ByteStr::new` (unstable under `bstr` feature) * `OsStr::new` * `Path::new` Those which directly use `Into`: * `Result::into_ok` * `Result::into_err` And those which use `Deref` and `DerefMut`: * `Pin::as_ref` * `Pin::as_mut` * `Pin::as_deref_mut` * `Option::as_deref` * `Option::as_deref_mut` * `Result::as_deref` * `Result::as_deref_mut` (note: the `Option` and `Result` methods were suggested by ``@npmccallum`` initially as rust-lang/rust#146101) The parts which are missing from this PR are: * Anything that involves heap-allocated types * Making any method const than the ones listed above * Anything that could rely on the above, *or* could rely on system-specific code for `OsStr` or `Path` (note: this mostly makes these methods useless since `str` doesn't implement `AsRef<OsStr>` yet, but it's better to track the method for now and add impls later, IMHO) r? ``@tgross35`` (who mostly already reviewed this)
2025-09-03Add `funnel_sh{l,r}` functions and intrinsicssayantn-0/+226
- Add a fallback implementation for the intrinsics - Add LLVM backend support for funnel shifts Co-Authored-By: folkertdev <folkert@folkertdev.nl>
2025-09-02add exact bitshiftsJeremy Smart-0/+231