about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-02-15Make phantom variance markers transparentJacob Pratt-0/+12
2025-02-14Rollup merge of #136983 - ehuss:misc-2024-prep, r=tgross35Jubilee-157/+250
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
2025-02-14Remove target_feature_11 feature which is now stableAmanieu d'Antras-1/+0
2025-02-14Update CI to FreeBSD 13.4Amanieu d'Antras-1/+1
The 13.3 image is no longer provided by Google Cloud.
2025-02-14proc_macro: Apply unsafe_op_in_unsafe_fnEric Huss-1/+2
2025-02-14std: Apply unsafe_op_in_unsafe_fnEric Huss-5/+5
2025-02-14Fix safety of windows uwp functionsEric Huss-2/+2
These functions were changed to be safe in https://github.com/rust-lang/rust/pull/127763, but this particular UWP version was missed. Otherwise this causes unnecessary unsafe block warnings/errors.
2025-02-14unwind: Apply unsafe_op_in_unsafe_fnEric Huss-9/+12
2025-02-14panic_unwind: Apply unsafe_op_in_unsafe_fnEric Huss-89/+110
2025-02-14panic_abort: Apply unsafe_op_in_unsafe_fnEric Huss-18/+35
2025-02-14core: Apply unsafe_op_in_unsafe_fnEric Huss-15/+15
2025-02-14Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgross35Matthias Krüger-84/+44
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr In the deferred initialization pattern, the docs were needlessly going through `as_mut_ptr().write()` to initialize, which is unnecessary use of a pointer, needs to be inside an `unsafe` block, and may weaken alias analysis.
2025-02-14Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboetMatthias Krüger-18/+11
Use `slice::fill` in `io::Repeat` implementation Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-14Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhprattMatthias Krüger-24/+12
Remove the common prelude module This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems. Closes https://github.com/rust-lang/rust/issues/136102
2025-02-14Rollup merge of #136052 - no1wudi:fix, r=workingjubileeMatthias Krüger-1/+1
Correct comment for FreeBSD and DragonFly BSD in unix/thread
2025-02-14Add safe new to NotAllOnesKornel-29/+24
2025-02-14Auto merge of #136735 - scottmcm:transmute-nonnull, r=oli-obkbors-1/+1
`transmute` should also assume non-null pointers Previously it only did integer-ABI things, but this way it does data pointers too. That gives more information in general to the backend, and allows slightly simplifying one of the helpers in slice iterators.
2025-02-13Rollup merge of #136992 - ehuss:update-backtrace, r=workingjubileeJubilee-0/+0
Update backtrace This updates the backtrace submodule. 6 commits in f8cc6ac9acc4e663ecd96f9bcf1ff4542636d1b9..9d2c34e7e63afe1e71c333b247065e3b7ba4d883 2025-01-04 03:37:47 +0100 to 2025-02-13 14:14:18 -0800 - Various cleanups: https://github.com/rust-lang/backtrace-rs/pull/673 - libunwind: Use builtin _Unwind_GetIP for NuttX on ARM platform: https://github.com/rust-lang/backtrace-rs/pull/692 - remove outdated docs part on Dbghelp::ensure_open: https://github.com/rust-lang/backtrace-rs/pull/696 - Cleanup Windows trace modules: https://github.com/rust-lang/backtrace-rs/pull/697 - Attempt to fix ARM32 Windows: https://github.com/rust-lang/backtrace-rs/pull/685 - Prepare backtrace for Rust 2024: https://github.com/rust-lang/backtrace-rs/pull/700
2025-02-13Rollup merge of #136908 - mustartt:aix-mutex-destory-einval, r=joboetJubilee-3/+3
[AIX] expect `EINVAL` for `pthread_mutex_destroy` Calling `pthread_mutex_destory` on a mutex initalized with the static initializer macro `PTHREAD_MUTEX_INITIALIZER` will result in `EINVAL` if the mutex is not lock/unlocked prior to calling `pthread_mutex_destroy`.
2025-02-13Rollup merge of #136904 - pitaj:range-into_bounds, r=tgross35Jubilee-1/+111
add `IntoBounds` trait for `range_into_bounds` feature Tracking issue: #136903 ACP: https://github.com/rust-lang/libs-team/issues/538
2025-02-13Update backtraceEric Huss-0/+0
2025-02-14Implement `f{16,32,64,128}::{erf,erfc}`Pavel Grigorenko-0/+280
Also add ```rust // #[unstable(feature = "float_gamma", issue = "99842")] ``` to `gamma`-function-related methods on `f16` & `f128`, as per https://github.com/rust-lang/rust/pull/136324#issuecomment-2626270247
2025-02-13std: Apply deprecated_safe_2024Eric Huss-42/+66
2025-02-13test: Apply deprecated_safe_2024Eric Huss-2/+6
2025-02-13std: Apply fixes for tail drop expressionsEric Huss-2/+2
2025-02-13std: Apply rust_2024_incompatible_patEric Huss-2/+2
2025-02-13std: Apply dependency_on_unit_never_type_fallbackEric Huss-1/+3
This generates a warning of irrefutable patterns. I decided to slightly tweak the example so the closure returns unit, since the intent wasn't to show the weird behavior of returning `!`.
2025-02-13std: Apply missing_unsafe_on_externEric Huss-2/+2
2025-02-13std: Apply unsafe_attr_outside_unsafeEric Huss-28/+28
2025-02-13alloc: Apply missing_unsafe_on_externEric Huss-1/+1
2025-02-13alloc: Apply unsafe_attr_outside_unsafeEric Huss-2/+2
2025-02-13alloc: Workaround hidden doctest lineEric Huss-1/+1
A small workaround for https://github.com/rust-lang/rust/issues/136899, rustdoc's invalid_rust_codeblocks was not handling this well in 2024. This may be needed when migrating to 2024 when building with stage0.
2025-02-13Migrate coretests to Rust 2024Eric Huss-8/+10
2025-02-13Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviperbors-103/+98
Stabilize `get_many_mut` as `get_disjoint_mut` Tracking issue: #104642 Closes #104642 FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13library: Update rand to 0.9.0Eric Huss-65/+126
2025-02-13core: Apply unsafe_attr_outside_unsafeEric Huss-1/+1
2025-02-13alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptrJed Brown-84/+44
In the deferred initialization pattern, the docs were needlessly going through as_mut_ptr().write() to initialize, which is unnecessary use of a pointer, needs to be inside an unsafe block, and may weaken alias analysis.
2025-02-13Consistently using as_mut_ptr() and as_ptr() in threadxizheyin-8/+11
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-13Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in unixxizheyin-13/+31
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-13Use `slice::fill` in `io::Repeat` implementationDaniPopes-18/+11
Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-13add `vec_nand`, `vec_nor`, `vec_eqv`, `vec_andc` and `vec_orc`Folkert de Vries-4/+212
2025-02-13s390x vector: add `vec_and`, `vec_or` and `vec_xor`Folkert de Vries-2/+58
2025-02-13s390x vector: add `vec_cntlz`, `vec_cnttz` and `vec_popcnt`Folkert de Vries-0/+114
2025-02-13Add the keylocker intrinsicssayantn-22/+543
2025-02-13Add runtime feature detection for keylockersayantn-1/+17
2025-02-13Windows: Update generated bindings to 0.59Chris Denton-2734/+2770
2025-02-13Rollup merge of #136949 - ehuss:wasm-bench-time, r=jhprattJacob Pratt-2/+1
Fix import in bench for wasm This import was causing annoying unused import errors when checking the standard library for some wasm targets. The problem is that everything here is disabled if it is wasm32, but this import wasn't cfg'd.
2025-02-13Rollup merge of #136660 - compiler-errors:BikeshedGuaranteedNoDrop, r=lcnrJacob Pratt-0/+17
Use a trait to enforce field validity for union fields + `unsafe` fields + `unsafe<>` binder types This PR introduces a new, internal-only trait called `BikeshedGuaranteedNoDrop`[^1] to faithfully model the field check that used to be implemented manually by `allowed_union_or_unsafe_field`. https://github.com/rust-lang/rust/blob/942db6782f4a28c55b0b75b38fd4394d0483390f/compiler/rustc_hir_analysis/src/check/check.rs#L84-L115 Copying over the doc comment from the trait: ```rust /// Marker trait for the types that are allowed in union fields, unsafe fields, /// and unsafe binder types. /// /// Implemented for: /// * `&T`, `&mut T` for all `T`, /// * `ManuallyDrop<T>` for all `T`, /// * tuples and arrays whose elements implement `BikeshedGuaranteedNoDrop`, /// * or otherwise, all types that are `Copy`. /// /// Notably, this doesn't include all trivially-destructible types for semver /// reasons. /// /// Bikeshed name for now. ``` As far as I am aware, there's no new behavior being guaranteed by this trait, since it operates the same as the manually implemented check. We could easily rip out this trait and go back to using the manually implemented check for union fields, however using a trait means that this code can be shared by WF for `unsafe<>` binders too. See the last commit. The only diagnostic changes are that this now fires false-negatives for fields that are ill-formed. I don't consider that to be much of a problem though. r? oli-obk [^1]: Please let's not bikeshed this name lol. There's no good name for `ValidForUnsafeFieldsUnsafeBindersAndUnionFields`.