about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-02-18Rollup merge of #136750 - kornelski:ub-bug, r=saethlinUrgau-3/+3
Make ub_check message clear that it's not an assert I've seen a user assume that their unsound code was *safe*, because ub_check prevented the program from performing the unsafe operation. This PR makes the panic message clearer that ub_check is a bug detector, not run-time safety protection.
2025-02-18update `cfg(bootstrap)`Josh Stone-338/+14
2025-02-18Fix typo in hidden internal docs of `TrustedRandomAccess`Frank Steffahn-4/+4
I typoed the coercion direction here 4 years ago; fixing it now
2025-02-18update version placeholdersJosh Stone-30/+30
(cherry picked from commit e4840ce59bdddb19394df008c5c26d9c493725f8)
2025-02-18Reorder "This lock may be advisory or mandatory." earlier in the lock docsJosh Triplett-18/+18
2025-02-18Clarify that locking on Windows also works for files opened with `.read(true)`Josh Triplett-5/+5
2025-02-18add last std diagnostic items for clippycyrgani-0/+7
2025-02-18Add #[track_caller] to Duration Div implPeter Todd-0/+2
Previously the location of the divide-by-zero error condition would be attributed to the code in the rust standard library, eg: thread 'main' panicked at /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/time.rs:1172:31: divide by zero error when dividing duration by scalar With #[track_caller] the error is correctly attributed to the callee.
2025-02-17Remove std::os::wasi::fs::FileExt::tellThalia Archibald-11/+0
Following #137165 (Use `tell` for `<File as Seek>::stream_position`), `tell` is now directly exposed via `stream_position`, making `<File as FileExt>::tell` redundant. Remove it.
2025-02-17Update some comparison tests now that they pass in LLVM20Scott McMurray-4/+4
2025-02-17Remove obsolete MinGW ThinLTO+TLS workaroundKornel-3/+1
#109797 is fixed
2025-02-17Rollup merge of #137165 - thaliaarchi:file-tell, r=ChrisDentonMatthias Krüger-1/+34
Use `tell` for `<File as Seek>::stream_position` Some platforms have a more efficient way to get the current offset of the file than by seeking. For example, Wasi has `fd_tell` and SOLID has `SOLID_FS_Ftell`. Implement `<File as Seek>::stream_position()` in terms of those. I do not use any APIs that were not already used in `std`. Although, the `libc` crate has [`ftell`](https://docs.rs/libc/latest/libc/fn.ftell.html), [`ftello`](https://docs.rs/libc/latest/libc/fn.ftello.html), and [`ftello64`](https://docs.rs/libc/latest/libc/fn.ftello64.html), I do not know platform coverage. It appears that Windows has no `tell`-like API. I have checked that it builds on each relevant platform.
2025-02-17Use tell for <File as Seek>::stream_positionThalia Archibald-1/+34
2025-02-17Auto merge of #137164 - matthiaskrgr:rollup-dj5826k, r=matthiaskrgrbors-1/+11
Rollup of 7 pull requests Successful merges: - #137095 (Replace some u64 hashes with Hash64) - #137100 (HIR analysis: Remove unnecessary abstraction over list of clauses) - #137105 (Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str.) - #137120 (Enable `relative-path-include-bytes-132203` rustdoc-ui test on Windows) - #137125 (Re-add missing empty lines in the releases notes) - #137145 (use add-core-stubs / minicore for a few more tests) - #137149 (Remove SSE ABI from i586-pc-windows-msvc) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-17tests: Also gate `f16::erfc()` doctest with `reliable_f16_math` cfgMartin Nordholts-0/+2
In 136324 the doctest for `f16::erf()` was gated with `reliable_f16_math`. Add the same gate on `f16::erfc()` to avoid: rust_out.71e2e529d20ea47d-cgu.0:\ (.text._ZN8rust_out4main43_doctest_main_library_std_src_f16_rs_1321_017h485f3ffe6bf2a981E+0x38): \ undefined reference to `__gnu_h2f_ieee' on MIPS (and maybe other architectures).
2025-02-17Rollup merge of #137105 - zachs18:cow-derefpure-restrict, r=NadrierilMatthias Krüger-1/+11
Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str. Fixes #136046 `feature(deref_patterns)` tracking issue: https://github.com/rust-lang/rust/issues/87121 `Cow<'_, T>` should only implement `DerefPure` if its `Deref` impl is pure, which requires `<T::Owned as Borrow<T>>::borrow` to be pure. This PR restricts `impl DerefPure for Cow<'_, T>` to `T: Sized + Clone`, `T = [U: Clone]`, and `T = str` (for all of whom `<T::Owned as Borrow<T>>::borrow` is implemented in the stdlib and is pure). cc ``@Nadrieril`` ------ An alternate approach would be to introduce a new `unsafe trait BorrowPure<T>` analogous to `DerefPure` that could be implemented for `T: Sized`, `&T`, `&mut T`, `String`, `Vec`, `Box`, `PathBuf`, `OsString`, etc. https://github.com/rust-lang/rust/compare/master...zachs18:borrow-pure-trait
2025-02-17Rollup merge of #137101 - GrigorenkoPV:str-inherent-lint, r=UrgauMatthias Krüger-0/+4
`invalid_from_utf8[_unchecked]`: also lint inherent methods Addressing https://github.com/rust-lang/rust/issues/131114#issuecomment-2646663535 Also corrected a typo: "_an_ invalid literal", not "_a_ invalid literal".
2025-02-17Rollup merge of #136844 - thaliaarchi:const-io-error, r=ChrisDentonMatthias Krüger-106/+90
Use `const_error!` when possible Replace usages of `io::Error::new(io::ErrorKind::Variant, "constant string")` with `io::const_error!(io::ErrorKind::Variant, "constant string")` to avoid allocations when possible. Additionally, fix `&&str` error messages in SGX and missing/misplaced trailing commas in `const_error!`.
2025-02-17stabilize (const_)ptr_sub_ptrbendn-21/+13
2025-02-16Synchronize platform adaptors for OsString/OsStrThalia Archibald-74/+119
* Order items as the average of the two adaptors. Enables easier diffs. * Consistently apply #[inline]. * Implement FromInner<Vec<u8>> for bytes::Buf. * Implement Clone::clone_from for wtf8::Buf.
2025-02-16Simplify control flow with while-letThalia Archibald-22/+14
2025-02-16Improve WTF-8 commentsThalia Archibald-15/+23
2025-02-16Rollup merge of #137114 - ChrisDenton:error, r=NoratriebMatthias Krüger-0/+24
Add an example for `std::error::Error` There is currently no example provided for `std::error::Error` so let's fix that.
2025-02-16Rollup merge of #136986 - ehuss:library-unsafe-fun, r=NoratriebMatthias Krüger-139/+181
Apply unsafe_op_in_unsafe_fn to the standard library This applies unsafe_op_in_unsafe_fn to the standard library in preparation for updating to Rust 2024. Closes https://github.com/rust-lang/rust/issues/127747 (I think?) cc ``@workingjubilee`` I have been testing a variety of targets, and I feel like they are all pretty much covered. I'll continue doing some testing async, but I don't expect to catch any more.
2025-02-16invalid_from_utf8[_unchecked]: also lint inherent methodsPavel Grigorenko-0/+4
2025-02-16add MAX_LEN_UTF8 and MAX_LEN_UTF16 constantsHTGAzureX1212-18/+49
2025-02-16fix docs for inherent str constructorsmay-8/+8
2025-02-16Add an example for std::error::ErrorChris Denton-0/+24
2025-02-15Restrict DerefPure for Cow<T> impl to T = impl Clone, [impl Clone], str.Zachary S-1/+11
2025-02-16Make ub_check message clear that it's not an assertKornel-3/+3
2025-02-15remove MaybeUninit::uninit_arraycyrgani-36/+0
2025-02-15docs: fix broken intra-doc links that never workedMichael Howell-9/+2
2025-02-15core: Make `Debug` impl of raw pointers print metadata if presentMartin Nordholts-5/+28
Make Rust pointers less magic by including metadata information in their `Debug` output. This does not break Rust stability guarantees because `Debug` output is explicitly exempted from stability: https://doc.rust-lang.org/std/fmt/trait.Debug.html#stability Co-authored-by: Lukas <26522220+lukas-code@users.noreply.github.com> Co-authored-by: Josh Stone <cuviper@gmail.com>
2025-02-15core: Document why Pointee::Metadata can't have 'static boundMartin Nordholts-0/+2
Co-authored-by: Lukas <26522220+lukas-code@users.noreply.github.com>
2025-02-15tests: Add regression test for `Debug` impl of raw pointersMartin Nordholts-0/+58
2025-02-15tests: Use `as *const _` instead of `.as_ptr()` in ptr fmt testMartin Nordholts-2/+2
Because `.as_ptr()` changes the type of the pointer (e.g. `&[u8]` becomes `*const u8` instead of `*const [u8]`), and it can't be expected that different types will be formatted the same way.
2025-02-15Auto merge of #137065 - jhpratt:rollup-ree9mej, r=jhprattbors-2767/+2899
Rollup of 9 pull requests Successful merges: - #135687 (re-export `FromCoroutine` from `core::iter`) - #135813 (CI: split i686-mingw job to three free runners) - #136749 (Implement Extend<AsciiChar> for String) - #136879 (Add safe new() to NotAllOnes) - #136978 (Windows: Update generated bindings) - #137028 (mir_build: Clarify some code for lowering `hir::PatExpr` to THIR) - #137029 (Remove unnecessary check code in unused_delims) - #137056 (made check_argument_compat public for use in miri) - #137062 (Forward all default methods for I/O impls) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-15Rollup merge of #137062 - thaliaarchi:io-optional-methods/write, ↵Jacob Pratt-0/+62
r=workingjubilee Forward all default methods for I/O impls Forward all default methods for `&mut T` and `Box<T>` to the inner `io::Read`, `io::Write`, `io::Seek`, and `io::BufRead` types.
2025-02-15Rollup merge of #136978 - ChrisDenton:windows-bindgen, r=AmanieuJacob Pratt-2734/+2770
Windows: Update generated bindings Update to windows-bindgen 0.59. This update is aimed at reducing churn in the future, but means a bit more churn now: - `bindings.txt` no longer needs us to write the namespace for each item. This is good because it means in the future we won't need to change them if the namespace changes. However, there are a few where we still need to disambiguate due to duplicate items (this is a bug in the upstream metadata). - The output in `windows-sys.rs` is now sorted. It was mostly sorted before but not intentionally. This should mean future changes are less noisy. The actual code changes are minimal here. A few types are now `bool` instead of `BOOLEAN`, which is more convenient.
2025-02-15Rollup merge of #136879 - kornelski:non1, r=NoratriebJacob Pratt-29/+24
Add safe new() to NotAllOnes Replaces duplicated `unsafe` code with a single, easier to verify implementation.
2025-02-15Rollup merge of #136749 - mzeitlin11:extend-asciichar, r=scottmcmJacob Pratt-0/+39
Implement Extend<AsciiChar> for String Implement `Extend<AsciiChar>` for `String` as suggested in https://github.com/rust-lang/rust/issues/110998#issuecomment-2590122968. Also implements `Extend<&AsciiChar>` since there's an analogous impl for `Extend<&char>`, but happy to remove if not thought useful. r? `@scottmcm` since you requested it, but no pressure to review!
2025-02-15Rollup merge of #135687 - joseluis:feat-reexport_from_coroutine, r=scottmcmJacob Pratt-4/+4
re-export `FromCoroutine` from `core::iter` tracking issue: https://github.com/rust-lang/rust/issues/43122 fixes: #135686
2025-02-15tidying up tidyprogressive-galib-4/+4
2025-02-14Add real safety commentsScott McMurray-1/+14
2025-02-14Go back to `Some` instead of transmuting to it.Scott McMurray-1/+1
This adds a few more statements to `next`, but optimizes better in the loops (saving 2 blocks in `forward_loop`, for example)
2025-02-14Save another BB by using `SubUnchecked` instead of a call to `arith_offset`Scott McMurray-5/+5
Probably reasonable anyway since it more obviously drops provenance.
2025-02-14Simplify `slice::Iter::next` enough that it inlinesScott McMurray-7/+17
2025-02-14Forward all default methods for I/O implsThalia Archibald-0/+62
2025-02-15replaced the four occurrences of issue ="50547" inprogressive.galib-4/+4
library/core/src/future/mod.rs with issue = "none"
2025-02-15Auto merge of #136324 - GrigorenkoPV:erf, r=tgross35bors-0/+280
Implement `f{16,32,64,128}::{erf,erfc}` (`#![feature(float_erf)]`) Tracking issue: #136321 try-job: x86_64-gnu-aux