about summary refs log tree commit diff
path: root/library/core
AgeCommit message (Collapse)AuthorLines
2025-02-20Implement 'PartialEq<{&Self, CString, Cow<Self>}>' for 'CStr'; Implement ↵Gabriel Bjørnager Jensen-0/+14
'PartialEq<{CStr, &CStr, Cow<CStr>}>' for 'CString'; Implement 'PartialEq<{CStr, &CStr, CString}>' for 'Cow<CStr>';
2025-02-20Guarantee behavior of transmuting Option::<T>::None subject to NPOJoshua Liebow-Feeser-14/+16
2025-02-20Implement feature `isolate_most_least_significant_one` for integer typesokaneco-0/+156
Implement accepted ACP for functions that isolate the most significant set bit and least significant set bit on unsigned, signed, and NonZero integers. Add function `isolate_most_significant_one` Add function `isolate_least_significant_one` Add tests
2025-02-19add `IntoBounds::intersect` and `RangeBounds::is_empty`Peter Jaszkowiak-5/+135
2025-02-20Auto merge of #137295 - matthiaskrgr:rollup-tdu3t39, r=matthiaskrgrbors-18/+7
Rollup of 9 pull requests Successful merges: - #135296 (interpret: adjust vtable validity check for higher-ranked types) - #137106 (Add customized compare for Link in rustdoc) - #137253 (Restrict `bevy_ecs` `ParamSet` hack) - #137262 (Make fewer crates depend on `rustc_ast_ir`) - #137263 (Register `USAGE_OF_TYPE_IR_INHERENT`, remove inherent usages) - #137266 (MIR visitor tweaks) - #137269 (Pattern Migration 2024: properly label `&` patterns whose subpatterns are from macro expansions) - #137277 (stabilize `inherent_str_constructors`) - #137281 (Tweak "expected ident" parse error to avoid talking about doc comments) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-20Rollup merge of #137277 - m4rch3n1ng:stabilize-inherent-str-constructors, ↵Matthias Krüger-18/+7
r=tgross35 stabilize `inherent_str_constructors` fcp done in https://github.com/rust-lang/rust/issues/131114#issuecomment-2668859969. tracking issue: #131114 closes: #131114
2025-02-19Auto merge of #137290 - matthiaskrgr:rollup-a7xdbi4, r=matthiaskrgrbors-23/+39
Rollup of 8 pull requests Successful merges: - #120580 (Add `MAX_LEN_UTF8` and `MAX_LEN_UTF16` Constants) - #132268 (Impl TryFrom<Vec<u8>> for String) - #136093 (Match Ergonomics 2024: update old-edition behavior of feature gates) - #136344 (Suggest replacing `.` with `::` in more error diagnostics.) - #136690 (Use more explicit and reliable ptr select in sort impls) - #136815 (CI: Stop /msys64/bin from being prepended to PATH in msys2 shell) - #136923 (Lint `#[must_use]` attributes applied to methods in trait impls) - #137155 (Organize `OsString`/`OsStr` shims) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-19Rollup merge of #136690 - ↵Matthias Krüger-18/+13
Voultapher:use-more-explicit-and-reliable-ptr-select, r=thomcc Use more explicit and reliable ptr select in sort impls Using `if ...` with the intent to avoid branches can be surprising to readers and carries the risk of turning into jumps/branches generated by some future compiler version, breaking crucial optimizations. This commit replaces their usage with the explicit and IR annotated `bool::select_unpredictable`.
2025-02-19Rollup merge of #120580 - HTGAzureX1212:HTGAzureX1212/issue-45795, r=m-ou-seMatthias Krüger-5/+26
Add `MAX_LEN_UTF8` and `MAX_LEN_UTF16` Constants This pull request adds the `MAX_LEN_UTF8` and `MAX_LEN_UTF16` constants as per #45795, gated behind the `char_max_len` feature. The constants are currently applied in the `alloc`, `core` and `std` libraries.
2025-02-19stabilize `inherent_str_constructors`may-18/+7
2025-02-19Rollup merge of #134995 - DaniPopes:stable-const_slice_flatten, r=AmanieuMatthias Krüger-2/+2
Stabilize const_slice_flatten Const-stabilizes `slice::as_flattened{,_mut}`: ```rust // core::slice impl<T, const N: usize> [[T; N]] { pub const fn as_flattened(&self) -> &[T]; pub const fn as_flattened_mut(&mut self) -> &mut [T]; } ``` Tracking issue: https://github.com/rust-lang/rust/issues/95629 Requires separate FCP, as per https://github.com/rust-lang/rust/issues/95629#issuecomment-2566546257. Closes https://github.com/rust-lang/rust/issues/95629. `````@rustbot````` modify labels: +T-libs-api Happy new year!
2025-02-19core/net: IpAddr*::as_octets()Nathan Perry-0/+60
Adds `const` `Ip*Addr::as_octets` methods providing reference access to `Ip*Addr` octets contents. See https://github.com/rust-lang/libs-team/issues/535 for accepted ACP with a more detailed justification.
2025-02-19Rollup merge of #137228 - steffahn:one-coerces-to-supertypes-not-subtypes, ↵Matthias Krüger-4/+4
r=the8472 Fix typo in hidden internal docs of `TrustedRandomAccess` I typoed the coercion direction here 4 years ago; fixing it now
2025-02-19Rollup merge of #137026 - GrigorenkoPV:integer_sign_cast, r=jhprattMatthias Krüger-9/+8
Stabilize (and const-stabilize) `integer_sign_cast` Tracking issue: #125882 Closes: #125882 FCP completed: https://github.com/rust-lang/rust/issues/125882#issuecomment-2658274124
2025-02-18Auto merge of #137235 - matthiaskrgr:rollup-2kjua2t, r=matthiaskrgrbors-8/+8
Rollup of 10 pull requests Successful merges: - #135711 (Do not ICE on default_field_value const with lifetimes) - #136599 (librustdoc: more usages of `Joined::joined`) - #136876 (Locking documentation updates) - #137000 (Deeply normalize item bounds in new solver) - #137126 (fix docs for inherent str constructors) - #137161 (Pattern Migration 2024: fix incorrect messages/suggestions when errors arise in macro expansions) - #137191 (Update mdbook and move error_index_generator) - #137203 (Improve MIR modification) - #137206 (Make E0599 a structured error) - #137218 (misc `layout_of` cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-18Remove outdated target `unexpected_cfgs`Josh Stone-1/+0
2025-02-18Rollup merge of #137126 - m4rch3n1ng:fix-inherent-str-docs, r=AmanieuMatthias Krüger-8/+8
fix docs for inherent str constructors related to #131114 when implementing inherent str constructors in #136517, i forgot to change the docs, so the code examples still imported the `std::str` module and used the constructor from there, instead of using "itself" (the inherent constructor).
2025-02-18Rollup merge of #137214 - cyrgani:clippy_diagnostic_items, r=compiler-errorsUrgau-0/+1
add last std diagnostic items for clippy Part of https://github.com/rust-lang/rust-clippy/issues/5393. Add diagnostic item attributes to the items in `std` and `core` where clippy currently uses hardcoded paths (https://github.com/rust-lang/rust-clippy/blob/master/clippy_utils/src/paths.rs).
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-129/+11
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-21/+21
(cherry picked from commit e4840ce59bdddb19394df008c5c26d9c493725f8)
2025-02-18add last std diagnostic items for clippycyrgani-0/+1
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-17Update some comparison tests now that they pass in LLVM20Scott McMurray-4/+4
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-17stabilize (const_)ptr_sub_ptrbendn-20/+13
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-15/+15
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-5/+26
2025-02-16fix docs for inherent str constructorsmay-8/+8
2025-02-16Add an example for std::error::ErrorChris Denton-0/+24
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-5/+2
2025-02-15core: Make `Debug` impl of raw pointers print metadata if presentMartin Nordholts-1/+24
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-15Rollup merge of #136879 - kornelski:non1, r=NoratriebJacob Pratt-0/+10
Add safe new() to NotAllOnes Replaces duplicated `unsafe` code with a single, easier to verify implementation.
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-15replaced the four occurrences of issue ="50547" inprogressive.galib-4/+4
library/core/src/future/mod.rs with issue = "none"
2025-02-15Make phantom variance markers transparentJacob Pratt-0/+12
2025-02-14Rollup merge of #136983 - ehuss:misc-2024-prep, r=tgross35Jubilee-1/+1
Prepare standard library for Rust 2024 migration This includes a variety of commits preparing the standard library for migration to Rust 2024. The actual migration is blocked on a few things, so I wanted to get this out of the way in a relatively digestable PR.
2025-02-14Rollup merge of #134016 - zachs18:stable-const-str-split_at, r=AmanieuJubilee-5/+5
Stabilize `const_is_char_boundary` and `const_str_split_at`. Tracking issues: #131516, #131518 Stabilized const API: ```rs // in `core` impl str { // const_is_char_boundary feature const fn is_char_boundary(&self, index: usize) -> bool; // const_str_split_at feature, depends on const_is_char_boundary const fn split_at(&self, mid: usize) -> (&str, &str); const fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str); const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)>; const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)>; } ``` This will allow safely splitting string slices during const-eval. Closes #131516, Closes #131518 This will need FCP. r? libs-api IIUC these do not use any new const language features (i.e. they are implementable manually on stable 1.83.0 using `unsafe`: [playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3679632cd1041084796241b7ac8edfbd)). Cc ``@rust-lang/wg-const-eval`` (I don't know if I have the permissions for this ping; if not, someone else please ping wg-const-eval if it is necessary)
2025-02-15Stabilize (and const-stabilize) `integer_sign_cast`Pavel Grigorenko-9/+8