about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-03-16add `vec_madd` and `vec_msub`Folkert de Vries-0/+63
2025-03-16add `vec_packs_cc` and `vec_packsu_cc`Folkert de Vries-6/+104
2025-03-16add `vec_pack`, `vec_packs` and `vec_packsu`Folkert de Vries-0/+182
2025-03-16add `vec_load_bndry`, `__lcbb` and `vec_load_pair`Folkert de Vries-3/+102
2025-03-16add `vec_load_len_r` and `vec_store_len_r`Folkert de Vries-0/+22
2025-03-16add `vec_load_len` and `vec_store_len`Folkert de Vries-0/+56
2025-03-16add `vec_xl` and `vec_xst`Folkert de Vries-0/+148
2025-03-16add `vec_reve`Folkert de Vries-0/+15
2025-03-16Add integer to string formatting testsGuillaume Gomez-0/+70
2025-03-16Add test for new proc_macro literal methodsGuillaume Gomez-1/+2
2025-03-16Document safety conditions of simd shiftsAlex Crichton-0/+40
2025-03-16Fix rustfmtAlex Crichton-1/+3
2025-03-16wasm32: Fix undefined behavior with shift intrinsicsAlex Crichton-15/+13
This commit fixes an issue where simd shift intrinsic in LLVM are undefined behavior if the shift amount is larger than the bit width of the lane. While in WebAssembly the corresponding instructions are defined as masking out the upper bits we need to represent that explicitly in LLVM IR to ensure that the semantics remain defined. cc rust-lang/rust#137941
2025-03-16Update SDE mirror to ci-mirrors.rust-lang.orgSayantan Chakraborty-3/+4
This is to combat the spurious CI failures in emulated run. Also helps with updatability and compatibility - it will work even if Intel changes the link
2025-03-16Rollup merge of #137538 - tapanprakasht:fix-doc-path, r=thomcc许杰友 Jieyou Xu (Joe)-4/+4
fix doc path in std::fmt macro fixes https://github.com/rust-lang/rust/issues/137519
2025-03-16Rollup merge of #137492 - nabijaczleweli:master, r=thomcc许杰友 Jieyou Xu (Joe)-1/+3
libstd: rustdoc: correct note on fds 0/1/2 pre-main Closes: #137490
2025-03-16Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc许杰友 Jieyou Xu (Joe)-3/+86
core: Make `Debug` impl of raw pointers print metadata if present Make Rust pointers appear less magic by including metadata information in their `Debug` output. This does not break Rust stability guarantees because `Debug` impl are explicitly exempted from stability: https://doc.rust-lang.org/std/fmt/trait.Debug.html#stability > ## Stability > > Derived `Debug` formats are not stable, and so may change with future Rust versions. Additionally, `Debug` implementations of types provided by the standard library (`std`, `core`, `alloc`, etc.) are not stable, and may also change with future Rust versions. Note that a regression test is added as a separate commit to make it clear what impact the last commit has on the output. Closes #128684 because the output of that code now becomes: ``` thread 'main' panicked at src/main.rs:5:5: assertion `left == right` failed left: Pointer { addr: 0x7ffd45c6fc6b, metadata: 5 } right: Pointer { addr: 0x7ffd45c6fc6b, metadata: 3 } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
2025-03-16Rollup merge of #138329 - scottmcm:assert-hint, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-0/+9
debug-assert that the size_hint is well-formed in `collect` Closes #137919 In the hopes of helping to catch any future accidentally-incorrect rustc or stdlib iterators (like the ones #137908 accidentally found), this has `Iterator::collect` call `size_hint` and check its `low` doesn't exceed its `Some(high)`. There's of course a bazillion more places this *could* be checked, but the hope is that this one is a good tradeoff of being likely to catch lots of things while having minimal maintenance cost (especially compared to putting it in *every* container's `from_iter`).
2025-03-16Rollup merge of #138323 - kpreid:offset-of-doc, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-36/+48
Expand and organize `offset_of!` documentation. * Give example of how to get the offset of an unsized tail field (prompted by discussion <https://github.com/rust-lang/rust/pull/133055#discussion_r1986422206>). * Specify the return type. * Add section headings. * Reduce “Visibility is respected…”, to a single sentence. * Move `offset_of_enum` documentation to unstable book (with link to it). * Add `offset_of_slice` documentation in unstable book. r? Mark-Simulacrum
2025-03-16Rollup merge of #138309 - DiuDiu777:intrinsic-doc-fix, r=thomcc许杰友 Jieyou Xu (Joe)-7/+24
Add missing doc for intrinsic (Fix PR135334) The previous [PR135334](https://github.com/rust-lang/rust/pull/135334) mentioned that some of the intrinsic APIs were missing safety descriptions. Among intrinsic APIs that miss safety specifications, most are related to numerical operations. They might need to be discussed and then seen how to organize. Apart from them, only a few intrinsics lack safety. So this PR deals with the APIs with non-numerical operations in priority.
2025-03-16Rollup merge of #138303 - DiuDiu777:rc-fix, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-20/+44
Fix Ptr inconsistency in {Rc,Arc} ### PR Description This pr aims to address the problem discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Inconsistency.20in.20.7BRc.2CArc.7D's.20ptr.20requirements/with/504259637). ### Problem Clarification As this post presents, the `{Rc, Arc}::{in/de-crement_strong_count_/in}` do not limit the layout of the memory that `ptr` points to, while internally `Rc::from_raw_in` is called directly. UB doesn't just appear when the strong count is decremented to zero. Miri also detects the UB of `out-of-bounds pointer use` when increment strong count is called on a pointer with an incorrect layout(shown as below). ```rust use std::rc::Rc; #[repr(align(8))] struct Aligned8(u64); #[repr(align(16))] struct Aligned16(u64); fn main() { let rc: Rc<Aligned8> = Rc::new(Aligned8(42)); let raw_ptr = Rc::into_raw(rc); unsafe { Rc::increment_strong_count(raw_ptr as *const Aligned16); } } ``` Miri output: ``` error: Undefined Behavior: out-of-bounds pointer use: expected a pointer to 32 bytes of memory, but got alloc954 which is only 24 bytes from the end of the allocation ```
2025-03-16Rollup merge of #138275 - folkertdev:expose-is-s390x-feature-detected, ↵许杰友 Jieyou Xu (Joe)-0/+32
r=Mark-Simulacrum expose `is_s390x_feature_detected!` from `std::arch` tracking issue: https://github.com/rust-lang/rust/issues/135413 implementation: https://github.com/rust-lang/stdarch/pull/1699 (more features added in https://github.com/rust-lang/stdarch/pull/1720) This macro was part of the recent `stdarch` synchronization, but not yet exposed via `std::arch`. r? libs
2025-03-16Rollup merge of #138082 - thaliaarchi:slice-cfg-not-test, r=thomcc许杰友 Jieyou Xu (Joe)-114/+79
Remove `#[cfg(not(test))]` gates in `core` These gates are unnecessary now that unit tests for `core` are in a separate package, `coretests`, instead of in the same files as the source code. They previously prevented the two `core` versions from conflicting with each other.
2025-03-16Rollup merge of #137890 - lolbinarycat:docs-bufreader-peek-consume, ↵许杰友 Jieyou Xu (Joe)-1/+5
r=Mark-Simulacrum doc: clarify that consume can be called after BufReader::peek tracking issue #128405
2025-03-16Rollup merge of #133055 - kpreid:clone-uninit-doc, r=Mark-Simulacrum许杰友 Jieyou Xu (Joe)-30/+145
Expand `CloneToUninit` documentation. * Clarify relationship to `dyn` after #133003. * Add an example of using it with `dyn` as #133003 enabled. * Replace parameter name `dst` with `dest` to avoid confusion between abbreviations for “DeSTination” and “Dynamically-Sized Type”. * Add an example of implementing it. * Add links to Rust Reference for the mentioned concepts. * Mention that its method should rarely be called. * Various small corrections. Please review the `unsafe` code closely, as I am not an expert in the best possible ways to express these operations. (It might also be better to omit the implementation example entirely.) cc `@zachs18` #126799
2025-03-15core/slice: Mark some `split_off` variants unstably constokaneco-8/+18
Introduce feature `const_split_off_first_last` Mark `split_off_first`, `split_off_first_mut`, `split_off_last`, and `split_off_last_mut` unstably const
2025-03-15Optimize multi-char string patternsYotam Ofek-4/+4
2025-03-14Auto merge of #138506 - fmease:rollup-ve4h2eq, r=fmeasebors-2/+5
Rollup of 9 pull requests Successful merges: - #134720 (Display valid crate types in error message for --crate-type flag) - #137619 (Provide helpful diagnostics for shebang lookalikes) - #138353 (remove must_use from <*const T>::expose_provenance) - #138452 (Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`) - #138469 (remove comment regarding a removed test directive) - #138477 (Deny impls for `BikeshedGuaranteedNoDrop`) - #138485 (Rustc dev guide subtree update) - #138487 (Pass `CI_JOB_DOC_URL` to Docker) - #138495 (Take a break from reviews) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-14Rollup merge of #138477 - compiler-errors:deny-bikeshed-guaranteed-no-drop, ↵León Orell Valerian Liehr-1/+5
r=lcnr Deny impls for `BikeshedGuaranteedNoDrop` r? lcnr
2025-03-14Rollup merge of #138353 - RalfJung:expose-provenance-must-use, r=ibraheemdevLeón Orell Valerian Liehr-1/+0
remove must_use from <*const T>::expose_provenance `<*mut T>::expose_provenance` does not have this attribute, and in fact the function is documented to have a side-effect, so there are perfectly legitimate use-cases where the return value would be ignored.
2025-03-14Auto merge of #137424 - Ayush1325:uefi-path-node, r=nicholasbishop,cuviperbors-0/+179
uefi: helpers: Add DevicePathNode abstractions - UEFI device path is a series of nodes layed out in a contiguous memory region. So it makes sense to use Iterator abstraction for modeling DevicePaths - This PR has been split off from #135368 for easier review. The allow dead_code will be removed in #135368 cc `@nicholasbishop`
2025-03-14Forward `stream_position` in `Arc<File>` as wellTobias Bucher-0/+3
It was missed in #137165.
2025-03-14Auto merge of #138480 - jhpratt:rollup-y3b8wu5, r=jhprattbors-82/+275
Rollup of 16 pull requests Successful merges: - #136001 (Overhaul examples for PermissionsExt) - #136230 (Reword incorrect documentation about SocketAddr having varying layout) - #136892 (Sync Fuchsia target spec with clang Fuchsia driver) - #136911 (Add documentation URL to selected jobs) - #137870 ( Improve HashMap docs for const and static initializers) - #138179 (Add `src/tools/x` to the main workspace) - #138389 (use `expect` instead of `allow`) - #138396 (Enable metrics and verbose tests in PR CI) - #138398 (atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance) - #138432 (fix: remove the check of lld not supporting `@response-file)` - #138434 (Visit `PatField` when collecting lint levels) - #138441 (update error message) - #138442 (EUV: fix place of deref pattern's interior's scrutinee) - #138457 (Remove usage of legacy scheme paths on RedoxOS) - #138461 (Remove an outdated line from a test comment) - #138466 (Remove myself from libs review) Failed merges: - #138452 (Remove `RUN_CHECK_WITH_PARALLEL_QUERIES`) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-14Rollup merge of #138457 - bjorn3:redox_scheme_paths, r=NoratriebJacob Pratt-14/+8
Remove usage of legacy scheme paths on RedoxOS The `name:/path` path syntax is getting phased out[^1] in favor of `/scheme/name/path`. Also using `null:` is no longer necessary as `/dev/null` is available on Redox OS too. [^1]: https://gitlab.redox-os.org/redox-os/rfcs/-/blob/master/text/0006-scheme-path.md cc `@jackpot51`
2025-03-14Rollup merge of #138398 - RalfJung:atomic-intrinsics-provenance, r=nnethercoteJacob Pratt-1/+152
atomic intrinsics: clarify which types are supported and (if applicable) what happens with provenance The provenance semantics match what Miri implements and what the `AtomicPtr` API expects.
2025-03-14Rollup merge of #137870 - karolzwolak:lazylock-const-hashmaps-137566, r=cuviperJacob Pratt-7/+19
Improve HashMap docs for const and static initializers Closes #137566. I clarified the HashMap usage in const and static initializers. I also added examples of how to construct such HashMaps wrapped in LazyLock.
2025-03-14Rollup merge of #136230 - clarfonthey:net-memory-layout-assumptions, r=cuviperJacob Pratt-11/+21
Reword incorrect documentation about SocketAddr having varying layout This has no longer been the case since these types were moved to `core`. The note on portability remains, but it is reworded to not imply that the size varies by target.
2025-03-14Rollup merge of #136001 - hkBst:patch-21, r=cuviperJacob Pratt-49/+75
Overhaul examples for PermissionsExt This fixes #91707 by including one overarching example, instead of the small examples that can be misleading.
2025-03-14Auto merge of #138157 - scottmcm:inline-more-tiny-things, r=oli-obkbors-2/+7
Allow more top-down inlining for single-BB callees This means that things like `<usize as Step>::forward_unchecked` and `<PartialOrd for f32>::le` will inline even if we've already done a bunch of inlining to find the calls to them. Fixes #138136 ~~Draft as it's built atop #138135, which adds a mir-opt test that's a nice demonstration of this. To see just this change, look at <https://github.com/rust-lang/rust/pull/138157/commits/48f63e3be552605c2933056b77bf23a326757f92>~~ Rebased to be just the inlining change, as the other existing tests show it great.
2025-03-14Deny impls for BikeshedGuaranteedNoDropMichael Goulet-1/+5
2025-03-13Remove has_redox_schemebjorn3-11/+2
Redox OS is moving away from name:/path style paths to /scheme/name/path style paths which are already handled correctly without has_redox_scheme.
2025-03-13Rollup merge of #138425 - cuviper:remove-hash_raw_entry, r=jhprattMatthias Krüger-564/+0
Remove `feature = "hash_raw_entry"` The `hash_raw_entry` feature finished [fcp-close](https://github.com/rust-lang/rust/issues/56167#issuecomment-2293805510) back in August, and its remaining uses in the compiler have now been removed, so we should be all clear to remove it from `std`. Closes #56167
2025-03-13Remove usage of legacy scheme paths on RedoxOSbjorn3-3/+6
The name:/path path syntax is getting phased out in favor of /scheme/name/path. Also using null: is no longer necessary as /dev/null is available on Redox OS too.
2025-03-14Mv os-specific trait impl of `Pipe*` into `std::os::*`Jiahao XU-208/+278
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-14Stablize feature `anonymous_pipe`Jiahao XU-45/+40
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-13Auto merge of #138450 - matthiaskrgr:rollup-4im25vf, r=matthiaskrgrbors-46/+44
Rollup of 6 pull requests Successful merges: - #137816 (attempt to support `BinaryFormat::Xcoff` in `naked_asm!`) - #138109 (make precise capturing args in rustdoc Json typed) - #138343 (Enable `f16` tests for `powf`) - #138356 (bump libc to 0.2.171 to fix xous) - #138371 (Update compiletest's `has_asm_support` to match rustc) - #138404 (Cleanup sysroot locating a bit) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-13Rollup merge of #138356 - betrusted-io:bump-libc-0.2.171, r=jhprattMatthias Krüger-3/+3
bump libc to 0.2.171 to fix xous Due to a reorganization in the `libc` crate, the `xous` target broke with version `0.2.170`. Bump libc to `0.2.171` to fix nightly.
2025-03-13Rollup merge of #138343 - tgross35:f16-powf, r=joboetMatthias Krüger-43/+41
Enable `f16` tests for `powf` The LLVM issue [1] was fixed with [2], which is included in the LLVM20 upgrade. Tests no longer fail, so enable them here. [1]: https://github.com/llvm/llvm-project/pull/98681 [2]: https://github.com/llvm/llvm-project/pull/98681 try-job: aarch64-gnu try-job: x86_64-gnu-aux
2025-03-13Rollup merge of #138370 - cuviper:try_oom_error, r=jhprattMatthias Krüger-6/+10
Simulate OOM for the `try_oom_error` test We can create the expected error manually, rather than trying to produce a real one, so the error conversion test can run on all targets. Before, it was only running on 64-bit and not miri. In Fedora, we also found that s390x was not getting the expected error, "successfully" allocating the huge size because it was optimizing the real `malloc` call away. It's possible to counter that by looking at the pointer in any way, like a debug print, but it's more robust to just deal with errors directly, since this test is only about conversion. Related: #133806
2025-03-13Rollup merge of #138162 - ehuss:library-2024, r=cuviperMatthias Krüger-19/+19
Update the standard library to Rust 2024 This updates the standard library to Rust 2024. This includes the following notable changes: - Macros are updated to use new expression fragment specifiers. This PR includes a test to illustrate the changes, primarily allowing `const {...}` expressions now. - Some tests show a change in MIR drop order. We do not believe this will be an observable change ([see zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/268952-edition/topic/standard.20library.20migration/near/500972873)). Fixes https://github.com/rust-lang/rust/issues/133081