about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-09-17Add space after brace in `Box<[T]>::new_uninit_slice` exampleAlan Wu-1/+1
2025-09-17Rollup merge of #146564 - cjgillot:mir-nolen, r=scottmcmStuart Cook-2/+9
Remove Rvalue::Len again. Now that we have `RawPtrKind::FakeForPtrMetadata`, we can reimplement `Rvalue::Len` using `PtrMetadata(&raw const (fake) place)`. r? ``@scottmcm``
2025-09-17Rollup merge of #146410 - hkBst:repeat-1, r=jhprattStuart Cook-3/+4
Iterator repeat: no infinite loop for `last` and `count` This removes two cases of infinite looping from [`Repeat`](https://doc.rust-lang.org/nightly/std/iter/struct.Repeat.html): - [`last`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.last): By viewing the iterator as returning None after [omega](https://en.wikipedia.org/wiki/Ordinal_number) calls to `next`, this method can simply return the repeated element. - [`count`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.count): From its docs: """The method does no guarding against overflows, so counting elements of an iterator with more than [usize::MAX](https://doc.rust-lang.org/nightly/std/primitive.usize.html#associatedconstant.MAX) elements either produces the wrong result or panics. If overflow checks are enabled, a panic is guaranteed.""", so a panic'ing impl is allowed by the docs, and is more honest than an infinite loop.
2025-09-17Rollup merge of #145660 - jbatez:darwin_objc, r=jdonszelmann,madsmtm,tmandryStuart Cook-0/+172
initial implementation of the darwin_objc unstable feature Tracking issue: https://github.com/rust-lang/rust/issues/145496 This feature makes it possible to reference Objective-C classes and selectors using the same ABI used by native Objective-C on Apple/Darwin platforms. Without it, Rust code interacting with Objective-C must resort to loading classes and selectors using costly string-based lookups at runtime. With it, these references can be loaded efficiently at dynamic load time. r? ```@tmandry``` try-job: `*apple*` try-job: `x86_64-gnu-nopt`
2025-09-17Rollup merge of #144871 - Kivooeo:btree_entry_insert-stabilize, r=jhprattStuart Cook-4/+2
Stabilize `btree_entry_insert` feature This stabilises `btree_map::VacantEntry::insert_entry` and `btree_map::Entry::insert_entry`, following the FCP in [tracking issue](https://github.com/rust-lang/rust/issues/65225). New stable API: ```rust impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> { pub fn insert_entry(self, value: V) -> OccupiedEntry<'a, K, V, A>; } impl<'a, K: Ord, V, A: Allocator + Clone> VacantEntry<'a, K, V, A> { pub fn insert_entry(mut self, value: V) -> OccupiedEntry<'a, K, V, A>; } ``` (FCP ended almost a year ago, so if it's needed for process we could rerun it) Closes: https://github.com/rust-lang/rust/issues/65225
2025-09-17Rollup merge of #142807 - sourcefrog:failfast, r=dtolnayStuart Cook-1/+3
libtest: expose --fail-fast as an unstable command-line option This exposes the `fail_fast` option added in rust-lang/rust#105153 on the test harness command line, so that workflows that only want to know if any test fails can find out without waiting for everything to run. For example, cargo-mutants just needs to know if any tests fails. It only works with `-Zunstable-options`. Tracking issue: rust-lang/rust#142859
2025-09-16Update docs.Camille Gillot-1/+2
2025-09-16Remove Rvalue::Len.Camille Gillot-1/+7
2025-09-16Rollup merge of #146474 - ferrocene:pvdrz/improve-ascii-coverage, r=NoratriebMatthias Krüger-0/+7
Improve `core::ascii` coverage This PR improves the `core::ascii` coverage by adding a new test to `coretests` r? `@workingjubilee`
2025-09-16Improve `core::sync::atomic` coverageChristian Poveda-4/+240
2025-09-16Improve `core::ascii` coverageChristian Poveda-0/+7
2025-09-16Fix other uses of "adaptor"Joe Birr-Pixton-1/+1
2025-09-16Fix spelling of "adaptor"Joe Birr-Pixton-1/+1
These docs are in en_US, so "adapter" is the correct spelling (and indeed used in the next line.)
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 #146549 - asomers:freebsd-readdir, r=Mark-SimulacrumMatthias Krüger-57/+63
On FreeBSD, use readdir instead of readdir_r readdir_r has the same problems on FreeBSD as it does on other platforms: it assumes a fixed NAME_MAX. And readdir has the same thread-safety guarantee as it does on other platforms: it's safe as long as only one thread tries to read from the directory stream at a given time. Furthermore, readdir_r is likely to be removed for FreeBSD 16, so we should stop using it now.
2025-09-15Rollup merge of #146546 - cammeresi:pop, r=Mark-SimulacrumMatthias Krüger-4/+4
Switch `std::vec::PeekMut::pop` from self to this parameter. Since PeekMut implements Deref, it shouldn't have any methods of its own. See also: `std::collections::binary_heap::PeekMut::pop` Pointed out: https://github.com/rust-lang/rust/issues/122742#issuecomment-3064050551 Related: rust-lang/rust#122742
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-15Merge pull request #1921 from a4lg/riscv-inline-asm-general-improvementsSayantan Chakraborty-51/+215
RISC-V: Improvements of inline assembly uses
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-15Merge pull request #1919 from sayantn/fix-vreinterpretFolkert de Vries-9286/+6
Remove big-endian swizzles from `vreinterpret`
2025-09-15Rollup merge of #146488 - ferrocene:pvdrz/improve-ptr-coverage, ↵Matthias Krüger-0/+8
r=Mark-Simulacrum Improve `core::ptr` coverage This PR improves the `core::ptr` coverage by adding a new test to `coretests` for the `<*const T>::is_aligned_to` method. r? libs
2025-09-15Rollup merge of #146478 - ferrocene:pvdrz/improve-fmt-coverage, ↵Matthias Krüger-0/+52
r=Mark-Simulacrum Improve `core::fmt` coverage This PR improves the `core::fmt` coverage by adding new tests to `coretests`
2025-09-15Rollup merge of #146284 - Kivooeo:blazing-fast-division-bignum, ↵Matthias Krüger-56/+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-14On FreeBSD, use readdir instead of readdir_rAlan Somers-57/+63
readdir_r has the same problems on FreeBSD as it does on other platforms: it assumes a fixed NAME_MAX. And readdir has the same thread-safety guarantee as it does on other platforms: it's safe as long as only one thread tries to read from the directory stream at a given time. Furthermore, readdir_r is likely to be removed for FreeBSD 16, so we should stop using it now.
2025-09-14Switch `std::vec::PeekMut::pop` from self to this parameter.Sidney Cammeresi-4/+4
Since PeekMut implements Deref, it shouldn't have any methods of its own. See also: `std::collections::binary_heap::PeekMut::pop`
2025-09-13std_detect Darwin AArch64: synchronize featuresLaine Taffin Altman-0/+11
Brings the list of checkable features up to date with the initial release of macOS 26 "Tahoe".
2025-09-13std_detect Darwin AArch64: re-alphabetizeLaine Taffin Altman-3/+3
2025-09-13std_detect Darwin AArch64: add new-style detection for FEAT_CRC32Laine Taffin Altman-2/+3
Now that this feature has a standard identifier, Darwin has started exposing it accordingly, in addition to the existing less-standard way. Check both, and enable the `crc` feature if either identifier for it is present to ensure backwards and forwards compatibility.
2025-09-14RISC-V: Improvements of inline assembly usesTsukasa OI-51/+215
This commit performs various improvements (better register allocation, less register clobbering on the worst case and better readability) of RISC-V inline assembly use cases. Note that it does not change the `p` module (which defines the "P" extension draft instructions but very likely to change). 1. Use `lateout` as possible. Unlike `out(reg)` and `in(reg)` pair, `lateout(reg)` and `in(reg)` can share the same register because they state that the late-output register is written after all the reads are performed. It can improve register allocation. 2. Add `preserves_flags` option as possible. While RISC-V doesn't have _regular_ condition codes, RISC-V inline assembly in the Rust language assumes that some registers (mainly vector state registers) may be overwritten by default. By adding `preserves_flags` to the intrinsics corresponding instructions without overwriting them, it can minimize register clobbering on the worst case. 3. Use trailing semicolon. As `asm!` declares an action and it doesn't return a value by itself, it would be better to have trailing semicolon to denote that an `asm!` call is effectively a statement. 4. Make most of `asm!` calls multi-lined. `rustfmt` makes some simple (yet long) `asm!` calls multi-lined but it does not perform formatting of complex `asm!` calls with inputs and/or outputs. To keep consistency, it makes most of the `asm!` calls multi-lined.
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/+172
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-13Rollup merge of #146517 - RalfJung:wait-timeout, r=joboetJacob Pratt-10/+8
fix Condvar::wait_timeout docs [Context](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Condvar.20wait_timeout.20sleep.20duration.20decremented/with/539279839) r? `@joboet`
2025-09-13Rollup merge of #146473 - RalfJung:system-time-deconst, r=workingjubileeJacob Pratt-183/+75
Revert "Constify SystemTime methods" This reverts https://github.com/rust-lang/rust/pull/144519. The const-hacks introduces bugs, and they make the code harder to maintain. Let's wait until we can constify these functions without changing their implementation. Fixes https://github.com/rust-lang/rust/issues/146228. Closes https://github.com/rust-lang/rust/issues/144517 (since the feature is gone). r? `@tgross35` Cc `@clarfonthey`
2025-09-13c-variadic: document `core::ffi::VaArgSafe`Folkert de Vries-6/+23
and document `VaList::arg`.
2025-09-13fix Condvar::wait_timeout docsRalf Jung-10/+8
2025-09-13fixup `become` kw documentation wrt `#[track_caller]`Waffle Lapkin-1/+4
2025-09-13Document `become` keywordMaybe Waffle-0/+99
2025-09-13also apply revert to wasip2Ralf Jung-18/+7
2025-09-13Rollup merge of #145471 - rs-sac:extr, r=the8472Jacob Pratt-14/+10
Stabilize BTree{Map,Set}::extract_if Tracking issue: rust-lang/rust#70530 FCP completed: https://github.com/rust-lang/rust/issues/70530#issuecomment-3191454465 Closes: rust-lang/rust#70530
2025-09-13Rollup merge of #146481 - ferrocene:pvdrz/improve-hash-coverage, r=jhprattJana Dönszelmann-0/+13
Improve `core::hash` coverage This PR improves the `core::hash` coverage by adding a new test to `coretests` and extending one of the existing tests to use 128-bit integers r? libs
2025-09-13Rollup merge of #146477 - ferrocene:pvdrz/improve-char-coverage, r=NoratriebJana Dönszelmann-0/+44
Improve `core::char` coverage This PR improves the `core::char` coverage by adding new tests to `coretests` r? ``@workingjubilee``
2025-09-13Rollup merge of #146452 - ferrocene:pvdrz/improve-alloc-coverage, r=tgross35Jana Dönszelmann-0/+24
Improve `alloc::Layout` coverage This PR improves the `core::alloc` coverage by adding a new test to `coretests` that cover the `Layout` methods when they error. Tracking issue: https://github.com/rust-lang/rust/issues/55724
2025-09-12Improve `core::ptr` coverageChristian Poveda-0/+8