summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-03-12Return OutOfMemoryError and update docsChris Denton-3/+3
(cherry picked from commit 3cb53df1feaba73b84344c8c0e3dc4120ad8c95b)
2025-03-12Windows: Use MoveFileEx by default in `fs:rename`Chris Denton-125/+60
(cherry picked from commit 0dfe2ae3fb72c50ea369286131c73daede13d7e5)
2025-02-13Revert "Stabilize `extended_varargs_abi_support`"Jubilee Young-0/+1
This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
2025-02-13Make `AsyncFnOnce`, `AsyncFnMut`, `AsyncFn` non-`#[fundamental]`Frank Steffahn-3/+0
(cherry picked from commit 71553822402dca6635ecd5ae8418bbafc3740cf4)
2025-02-06Revert "Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper"Rémy Rakic-1/+2
This reverts commit e108481f74ff123ad98a63bd107a18d13035b275, reversing changes made to 303e8bd768526a5812bb1776e798e829ddb7d3ca. (cherry picked from commit ca1c17c88d1f625763859396ba7a50f36ac45cc0)
2025-02-01Fix core AsyncFn stability attributeEric Huss-1/+2
2025-02-01Rollup merge of #135852 - lukas-code:asyncfn-prelude-core, r=compiler-errorsMatthias Krüger-0/+3
Add `AsyncFn*` to `core` prelude In https://github.com/rust-lang/rust/pull/132611 these got added to the `std` prelude only, which looks like an oversight. r? libs-api cc `@compiler-errors`
2025-01-25Remove test panic from File::openChris Denton-3/+0
(cherry picked from commit fed5f98c47e64bc5e96679165d16e5eec8b4917e)
2025-01-16add regression test for unsound Flatten/FlatMap specializationThe 8472-0/+14
(cherry picked from commit 1ed0ea459dc5456ebcedb798cc88671014cf0f68)
2025-01-16do not in-place-iterate over flatmap/flattenThe 8472-51/+8
The implementation is unsound when a partially consumed iterator has some elements buffered in the front/back parts and cloning the Iterator removes the capacity from the backing vec::IntoIter. (cherry picked from commit 3d871b3ced0af12a84e3d17060399ca1af8d7bc1)
2025-01-07update version placeholdersPietro Albini-70/+70
2025-01-03Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgrbors-1/+1
Rollup of 4 pull requests Successful merges: - #131729 (Make the `test` cfg a userspace check-cfg) - #134241 (more concrete source url of std docs [V2]) - #135042 (taint fcx on selection errors during unsizing) - #135049 (Remove unused fields from RepeatElementCopy obligation) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-03Rollup merge of #134241 - liigo:patch-16, r=dtolnayMatthias Krüger-1/+1
more concrete source url of std docs [V2] r? jhpratt since you have reivewed https://github.com/rust-lang/rust/pull/134193 > If someone is looking to contribute, they will want the repository as a whole, not the lib.rs for std. Now the repository url is reserved, I just add another concrete url as an example, to help people finding target page more quickly&easily.
2025-01-03Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35bors-27/+131
Move some things to `std::sync::poison` and reexport them in `std::sync` Tracking issue: #134646 r? `@tgross35` I've used `sync_poison_mod` feature flag instead, because `sync_poison` had already been used back in 1.2. try-job: x86_64-msvc
2025-01-02Bump backtrace to rust-lang/backtrace-rs@4d7906bJubilee Young-0/+0
Compare: https://github.com/rust-lang/backtrace-rs/compare/230570f...4d7906b Mostly cleanups and enabling backtraces for the RTEMS target.
2025-01-02Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472bors-1/+17
Try to write the panic message with a single `write_all` call This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines. Before: ``` thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9: : 999: 999: assertion failed: size <= (*queue).block_size: : assertion failed: size <= (*queue).block_size: assertion failed: size <= (*queue).block_size: : : assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` After: ``` thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` --- try-jobs: x86_64-gnu-llvm-18
2025-01-02path in detailLiigo Zhuang-1/+1
2025-01-02Move some things to `std::sync::poison` and reexport them in `std::sync`Pavel Grigorenko-27/+131
2025-01-02fix doc for missing Box allocator consistencyLemonJ-0/+3
2025-01-01Auto merge of #135005 - matthiaskrgr:rollup-5ubuitt, r=matthiaskrgrbors-1/+1
Rollup of 5 pull requests Successful merges: - #134967 (handle submodules automatically on `doc` steps) - #134973 (Fix typos) - #134984 (`ObligationCause` construction tweaks in typeck) - #134985 (Remove qualification of `std::cmp::Ordering` in `Ord` doc) - #135000 (Fix ICE when opaque captures a duplicated/invalid lifetime) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-01Rollup merge of #134985 - ↵Matthias Krüger-1/+1
mgsloan:remove-unnecessary-qualification-in-Ord-trait-docs, r=Noratrieb Remove qualification of `std::cmp::Ordering` in `Ord` doc
2025-01-01Auto merge of #134080 - kleisauke:avoid-lfs64-emscripten, r=Noratriebbors-17/+3
Avoid use of LFS64 symbols on Emscripten Since Emscripten uses musl libc internally. Non-functional change: all LFS64 symbols were aliased to their non-LFS64 counterparts in rust-lang/libc@7c952dceaad4cdc35e00884fcb12a713d41a87e0.
2025-01-01Try to write the panic message with a single `write_all` callJohn Kåre Alsaker-1/+17
2025-01-01std::fs::DirEntry.metadata(): prefer use of lstat() on EmscriptenKleis Auke Wolthuizen-8/+1
Align it with musl, which also prefers using lstat() here.
2025-01-01Avoid use of LFS64 symbols on EmscriptenKleis Auke Wolthuizen-9/+2
Since Emscripten uses musl libc internally. Non-functional change: all LFS64 symbols were aliased to their non-LFS64 counterparts in rust-lang/libc@7c952dceaad4cdc35e00884fcb12a713d41a87e0.
2025-01-01Auto merge of #134969 - Marcondiro:master, r=jhpratt,programmerjakebors-7/+11
char to_digit: avoid unnecessary casts to u64 Hello, in the `char::to_digit` method there are a few `as u64` casts that are not strictly necessary. I assume that the reason behind these casts is to avoid possible overflows in the `+ 10` add. This PR removes the aforementioned casts, avoiding the overflow issue by slightly modifying the ASCII letter to int mapping. Thanks, Happy new year.
2025-01-01Rollup merge of #131439 - mu001999-contrib:cleanup/static-mut, r=estebankStuart Cook-2/+0
Remove allowing static_mut_refs lint
2024-12-31Remove qualification of `std::cmp::Ordering` in `Ord` docMichael Sloan-1/+1
2024-12-31Auto merge of #132195 - clarfonthey:bigint-mul, r=scottmcmbors-123/+388
Tidy up bigint multiplication methods This tidies up the library version of the bigint multiplication methods after the addition of the intrinsics in #133663. It follows [this summary](https://github.com/rust-lang/rust/issues/85532#issuecomment-2403442775) of what's desired for these methods. Note that, if `2H = N`, then `uH::MAX * uH::MAX + uH::MAX + uH::MAX` is `uN::MAX`, and that we can effectively add two "carry" values without overflowing. For ease of terminology, the "low-order" or "least significant" or "wrapping" half of multiplication will be called the low part, and the "high-order" or "most significant" or "overflowing" half of multiplication will be called the high part. In all cases, the return convention is `(low, high)` and left unchanged by this PR, to be litigated later. ## API Changes The original API: ```rust impl uN { // computes self * rhs pub const fn widening_mul(self, rhs: uN) -> (uN, uN); // computes self * rhs + carry pub const fn carrying_mul(self, rhs: uN, carry: uN) -> (uN, uN); } ``` The added API: ```rust impl uN { // computes self * rhs + carry1 + carry2 pub const fn carrying2_mul(self, rhs: uN, carry: uN, add: uN) -> (uN, uN); } impl iN { // note that the low part is unsigned pub const fn widening_mul(self, rhs: iN) -> (uN, iN); pub const fn carrying_mul(self, rhs: iN, carry: iN) -> (uN, iN); pub const fn carrying_mul_add(self, rhs: iN, carry: iN, add: iN) -> (uN, iN); } ``` Additionally, a naive implementation has been added for `u128` and `i128` since there are no double-wide types for those. Eventually, an intrinsic will be added to make these more efficient, but rather than doing this all at once, the library changes are added first. ## Justifications for API The unsigned parts are done to ensure consistency with overflowing addition: for a two's complement integer, you want to have unsigned overflow semantics for all parts of the integer except the highest one. This is because overflow for unsigned integers happens on the highest bit (from `MAX` to zero), whereas overflow for signed integers happens on the second highest bit (from `MAX` to `MIN`). Since the sign information only matters in the highest part, we use unsigned overflow for everything but that part. There is still discussion on the merits of signed bigint *addition* methods, since getting the behaviour right is very subtle, but at least for signed bigint *multiplication*, the sign of the operands does make a difference. So, it feels appropriate that at least until we've nailed down the final API, there should be an option to do signed versions of these methods. Additionally, while it's unclear whether we need all three versions of bigint multiplication (widening, carrying-1, and carrying-2), since it's possible to have up to two carries without overflow, there should at least be a method to allow that. We could potentially only offer the carry-2 method and expect that adding zero carries afterword will optimise correctly, but again, this can be litigated before stabilisation. ## Note on documentation While a lot of care was put into the documentation for the `widening_mul` and `carrying_mul` methods on unsigned integers, I have not taken this same care for `carrying_mul_add` or the signed versions. While I have updated the doc tests to be more appropriate, there will likely be many documentation changes done before stabilisation. ## Note on tests Alongside this change, I've added several tests to ensure that these methods work as expected. These are alongside the codegen tests for the intrinsics.
2024-12-31Auto merge of #134966 - matthiaskrgr:rollup-lmhmgsv, r=matthiaskrgrbors-4/+0
Rollup of 4 pull requests Successful merges: - #134610 (Format `build.toml` consistently in platform support docs) - #134918 (Windows: Enable issue 70093 link tests) - #134953 (Fix doc for read&write unaligned in zst operation) - #134956 (Account for C string literals and `format_args` in `HiddenUnicodeCodepoints` lint) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-31char to_digit: avoid unnecessary casts to u64Marcondiro-7/+11
2024-12-31Rollup merge of #134953 - DiuDiu777:unaligned-doc, r=RalfJungMatthias Krüger-4/+0
Fix doc for read&write unaligned in zst operation ### PR Description This PR addresses an inconsistency in the Rust documentation regarding `read_unaligned ` and `write_unaligned` on zero-sized types (ZSTs). The current documentation for [pointer validity](https://doc.rust-lang.org/nightly/std/ptr/index.html#safety) states that for zero-sized types (ZSTs), null pointers are valid: > For zero-sized types (ZSTs), every pointer is valid, including the null pointer. However, there is an inconsistency in the documentation for the unaligned read operation in the function [ptr::read_unaligned](https://doc.rust-lang.org/nightly/std/ptr/fn.read_unaligned.html)(as well as `write_unaligned`), which states: > Note that even if T has size 0, the pointer must be non-null. This change is also supported by [PR #134912](https://github.com/rust-lang/rust/pull/134912) > the _unaligned method docs should be fixed.
2024-12-31Auto merge of #134620 - ChrisDenton:line-writer, r=tgross35bors-6/+21
Avoid short writes in LineWriter If the bytes written to `LineWriter` contains at least one new line but doesn't end in a new line (e.g. `"abc\ndef"`) then we: - write up to the last new line direct to the underlying `Writer`. - copy as many of the remaining bytes as will fit into our internal buffer. That last step is inefficient if the remaining bytes are larger than our buffer. It will needlessly split the bytes in two, requiring at least two writes to the underlying `Writer` (one to flush the buffer, one more to write the rest). This PR skips the extra buffering if the remaining bytes are larger than the buffer.
2024-12-31Rollup merge of #134930 - RalfJung:ptr-docs-valid-access, r=jhprattStuart Cook-2/+2
ptr docs: make it clear that we are talking only about memory accesses This should make it harder to take this sentence out of context and misunderstand it.
2024-12-31Rollup merge of #134927 - DaniPopes:const-as_flattened_mut, r=scottmcmStuart Cook-1/+2
Make slice::as_flattened_mut unstably const Tracking issue: https://github.com/rust-lang/rust/issues/95629 Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
2024-12-31fix doc for read write unaligned in zst operationLemonJ-4/+0
2024-12-30Auto merge of #134757 - RalfJung:const_swap, r=scottmcmbors-12/+25
stabilize const_swap libs-api FCP passed in https://github.com/rust-lang/rust/issues/83163. However, I only just realized that this actually involves an intrinsic. The intrinsic could be implemented entirely with existing stable const functionality, but we choose to make it a primitive to be able to detect more UB. So nominating for `@rust-lang/lang` to make sure they are aware; I leave it up to them whether they want to FCP this. While at it I also renamed the intrinsic to make the "nonoverlapping" constraint more clear. Fixes #83163
2024-12-30ptr docs: make it clear that we are talking only about memory accessesRalf Jung-2/+2
2024-12-30Make slice::as_flattened_mut unstably constDaniPopes-1/+2
Tracking issue: https://github.com/rust-lang/rust/issues/95629 Unblocked by const_mut_refs being stabilized: https://github.com/rust-lang/rust/pull/129195
2024-12-29Rollup merge of #134884 - calciumbe:patch1, r=jieyouxuMatthias Krüger-2/+2
Fix typos Hello, I fix some typos in docs and comments. Thank you very much.
2024-12-29Rollup merge of #134870 - geofft:patch-1, r=jhprattMatthias Krüger-1/+1
Fix sentence fragment in `pin` module docs Looks like this was inadvertently dropped in 8241ca60. Restore the words from before that commit.
2024-12-29fix: typoscalciumbe-2/+2
Signed-off-by: calciumbe <192480234+calciumbe@users.noreply.github.com>
2024-12-29Rollup merge of #134851 - lukas-code:alloc-ffi, r=tgross35Stuart Cook-1/+1
docs: inline `alloc::ffi::c_str` types to `alloc::ffi` like https://github.com/rust-lang/rust/pull/134791 but for `alloc` r? ``@tgross35`` ``@notriddle``
2024-12-28Fix sentence fragment in `pin` module docsGeoffrey Thomas-1/+1
Looks like this was inadvertently dropped in 8241ca60. Restore the words from before that commit.
2024-12-28docs: inline `alloc::ffi::c_str` types to `alloc::ffi`Lukas Markeffsky-1/+1
2024-12-28Auto merge of #134547 - SUPERCILEX:unify-copy, r=thomccbors-24/+70
Unify fs::copy and io::copy on Linux Currently, `fs::copy` first tries a regular file copy (via copy_file_range) and then falls back to userspace read/write copying. We should use `io::copy` instead as it tries copy_file_range, sendfile, and splice before falling back to userspace copying. This was discovered here: https://github.com/SUPERCILEX/fuc/issues/40 Perf impact: `fs::copy` will now have two additional statx calls to decide which syscall to use. I wonder if we should get rid of the statx calls and only continue down the next fallback when the relevant syscalls say the FD isn't supported.
2024-12-28Rollup merge of #134832 - tgross35:update-builtins, r=tgross35Stuart Cook-4/+4
Update `compiler-builtins` to 0.1.140 Nothing significant here, just syncing the following small changes: - https://github.com/rust-lang/compiler-builtins/pull/727 - https://github.com/rust-lang/compiler-builtins/pull/730 - https://github.com/rust-lang/compiler-builtins/pull/736 - https://github.com/rust-lang/compiler-builtins/pull/737
2024-12-27Tidy up bigint mul methodsltdk-123/+388
2024-12-27Rollup merge of #134823 - chloefeal:fix, r=tgross35,dtolnayDavid Tolnay-2/+2
Fix typos This PR focuses on correcting typos and improving clarity in documentation files. Thank you.
2024-12-28Update library/alloc/tests/sort/tests.rschloefeal-1/+1
Co-authored-by: David Tolnay <dtolnay@gmail.com>