about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2025-03-17move new section into platform-specific behavior, as it is unix-specificRalf Jung-21/+20
2025-03-17Mark imports of #[rustc_std_internal_symbol] items with this attributebjorn3-0/+3
This ensures that they will be correctly mangled in a future commit.
2025-03-17Rollup merge of #137793 - NobodyXu:stablise-annoymous-pipe, r=joshtriplettJacob Pratt-221/+288
Stablize anonymous pipe Since #135822 is staled, I create this PR to stablise anonymous pipe Closes #127154 try-job: test-various
2025-03-17Rollup merge of #137621 - Berrysoft:cygwin-std, r=joboetJacob Pratt-14/+188
Add std support to cygwin target
2025-03-16Rollup merge of #138573 - Noratrieb:no-unsound-bad-bonk-bonk, r=workingjubileeJacob Pratt-2/+2
Make `_Unwind_Action` a type alias, not enum It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check. I ran `x check library --target aarch64-unknown-linux-gnu,x86_64-pc-windows-gnu,x86_64-fortanix-unknown-sgx,x86_64-unknown-haiku,x86_64-unknown-fuchsi a,x86_64-unknown-freebsd,x86_64-unknown-dragonfly,x86_64-unknown-netbsd,x86_64-unknown-openbsd,x86_64-unknown-redox,riscv64-linux-android,armv7-unknown-freebsd` (and some more but they failed to build for other reasons :D) fixes #138558 r? workingjubilee have fun
2025-03-16make `_Unwind_Action` a type alias, not enumNoratrieb-2/+2
It's bitflags in practice, so an enum is unsound, as an enum must only have the described values. The x86_64 psABI declares it as a `typedef int _Unwind_Action`, which seems reasonable. I made a newtype first but that was more annoying than just a typedef. We don't really use this value for much other than a short check.
2025-03-17uefi: Add OwnedEvent abstractionAyush Singh-38/+58
- Events are going to become quite important for Networking, so needed owned abstractions. - Switch to OwnedEvent abstraction for Exit boot services event. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
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 #138275 - folkertdev:expose-is-s390x-feature-detected, ↵许杰友 Jieyou Xu (Joe)-0/+2
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 #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-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-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 #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 #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-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-43/+40
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
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-2/+2
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
2025-03-13Rollup merge of #137355 - thaliaarchi:io-optional-methods/sgx, r=ChrisDentonMatthias Krüger-19/+97
Implement `read_buf` and vectored read/write for SGX stdio Implement `read_buf`, `read_vectored`, and `write_vectored` for the SGX stdio types. Additionally, extend `User<T>::copy_to_enclave` to work for copying to uninitialized values and fix unsoundness in `UserRef<[T]>::copy_to_enclave_vec`. cc ``@jethrogb`` Tracked in https://github.com/rust-lang/rust/issues/136756
2025-03-13Rollup merge of #136842 - randomPoison:trusty-libstd-v3, r=ChrisDentonMatthias Krüger-10/+173
Add libstd support for Trusty targets This PR adds support for `alloc` and `std` for the Trusty targets based on the internal patches used in Android. The original patches can be seen [here](https://android.googlesource.com/toolchain/android_rust/+/refs/heads/main/patches/development/rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch) and [here](https://android.googlesource.com/toolchain/android_rust/+/refs/heads/main/patches/development/rustc-0054-Add-std-os-fd-support-for-Trusty.patch). Please let me know if there's any additional context I need to add.
2025-03-13Auto merge of #138416 - Manishearth:rollup-fejor9p, r=Manishearthbors-2/+2
Rollup of 12 pull requests Successful merges: - #134076 (Stabilize `std::io::ErrorKind::InvalidFilename`) - #137504 (Move methods from Map to TyCtxt, part 4.) - #138175 (Support rmeta inputs for --crate-type=bin --emit=obj) - #138259 (Disentangle `ForwardGenericParamBan` and `ConstParamTy` ribs) - #138280 (fix ICE in pretty-printing `global_asm!`) - #138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js) - #138331 (Use `RUSTC_LINT_FLAGS` more) - #138357 (merge `TypeChecker` and `TypeVerifier`) - #138394 (remove unnecessary variant) - #138403 (Delegation: one more ICE fix for `MethodCall` generation) - #138407 (Delegation: reject C-variadics) - #138409 (Use sa_sigaction instead of sa_union.__su_sigaction for AIX) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-12Remove `feature = "hash_raw_entry"`Josh Stone-564/+0
2025-03-12Rollup merge of #134076 - GrigorenkoPV:InvalidFilename, r=joboetManish Goregaokar-2/+2
Stabilize `std::io::ErrorKind::InvalidFilename` FCP complete: https://github.com/rust-lang/rust/issues/130192#issuecomment-2674989358 Tracking issues: #86442 & #130192 This PR: - Stabilizes `InvalidFilename` without changing its name to `InvalidFileName`. - Fixes the doc comment (https://github.com/rust-lang/rust/issues/130192#issuecomment-2429534640) - Does not separate "the name is too long" case into a separate `ErrorKind`. That case is currently documented to be covered by `InvalidFilename` in the doc. I'm not sure if it would be possible to change this later or if that would be an unacceptable breaking change. - Does not map more raw OS errors to this `ErrorKind` (as suggested in https://github.com/rust-lang/rust/issues/86442#issuecomment-1441709738). This can presumably be addressed later.
2025-03-12Rollup merge of #138269 - Ayush1325:uefi-fs-permission, r=joboetMatthias Krüger-64/+35
uefi: fs: Implement FileType, FilePermissions and FileAttr - In UEFI, both FileType and FilePermissions are represented by the attr bitfield. - Using simple bools here since both are represented by a single bit. - Add `FILE_PERMISSION` mask for constructing attribute while change permissions. cc ````@nicholasbishop````
2025-03-12Fix panic handler for cygwinBerrysoft-1/+4
2025-03-11Fix `UserRef<[T]>::copy_to_enclave_vec`Thalia Archibald-13/+6
It reinterprets uninitialized memory as initialized and does not drop existing elements of the Vec. Fix that. Additionally, make it more general by appending, instead of overwriting existing elements, and rename it to `append_to_enclave_vec`. A caller can simply call `.clear()` before, for the old behavior.
2025-03-11Auto merge of #138366 - matthiaskrgr:rollup-cn16m7q, r=matthiaskrgrbors-0/+37
Rollup of 10 pull requests Successful merges: - #137715 (Allow int literals for pattern types with int base types) - #138002 (Disable CFI for weakly linked syscalls) - #138051 (Add support for downloading GCC from CI) - #138231 (Prevent ICE in autodiff validation by emitting user-friendly errors) - #138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments) - #138256 (Do not feed anon const a type that references generics that it does not have) - #138284 (Do not write user type annotation for const param value path) - #138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT) - #138352 (miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access) - #138354 (remove redundant `body` arguments) r? `@ghost` `@rustbot` modify labels: rollup
2025-03-11Deduplicate platform stdio typesThalia Archibald-126/+31
2025-03-11Simulate OOM for the `try_oom_error` testJosh Stone-6/+10
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.
2025-03-11Rollup merge of #138002 - 1c3t3a:fix-std-cfi-violation, r=rcvalleMatthias Krüger-0/+37
Disable CFI for weakly linked syscalls Currently, when enabling CFI via -Zsanitizer=cfi and executing e.g. std::sys::random::getrandom, we can observe a CFI violation. This is the case for all consumers of the std::sys::pal::weak::syscall macro, as it is defining weak functions which don't show up in LLVM IR metadata. CFI fails for all these functions. Similar to other such cases in https://github.com/rust-lang/rust/issues/115199, this change stops emitting the CFI typecheck for consumers of the macro via the `#[no_sanitize(cfi)]` attribute. r? ``````@rcvalle``````
2025-03-11Auto merge of #128440 - oli-obk:defines, r=lcnrbors-0/+10
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed. A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table. Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable. Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature. One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now. fixes #131298
2025-03-11Migrate std to Rust 2024Eric Huss-2/+2
2025-03-11Rollup merge of #137967 - mustartt:fix-aix-test-hangs, r=workingjubileeJakub Beránek-4/+19
[AIX] Fix hangs during testing Fixes all current test hangs experienced during CI runs. 1. ipv6 link-local (the loopback device) gets assigned an automatic zone id of 1, causing the assert to fail and hang in `library/std/src/net/udp/tests.rs` 2. Const alloc does not fail gracefully 3. Debuginfo test has problem with gdb auto load safe path
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-0/+10
2025-03-11Stabilize `std::io::ErrorKind::InvalidFilename`Pavel Grigorenko-2/+2
2025-03-10Remove unused fileNicole L-4/+0
2025-03-10Update Trusty support to account for recent libstd reorganizationNicole L-7/+3
2025-03-10Remove custom TLS implementation for Trusty targetsNicole LeGare-39/+2
2025-03-10Disable unsupported testsNicole LeGare-4/+8
Unclear why this needs to be done manually and is not done by the existing Trusty patches.
2025-03-10Format after patches have been appliedNicole LeGare-13/+17
2025-03-10Apply rustc-0054-Add-std-os-fd-support-for-Trusty.patchNicole LeGare-6/+43
2025-03-10Apply rustc-0023-Add-Trusty-OS-support-to-Rust-std.patchNicole LeGare-0/+163
2025-03-10Mark some std tests as requiring `panic = "unwind"`Paul Menage-0/+5
This allows these test modules to pass on builds/targets without unwinding support, where `panic = "abort"` - the ignored tests are for functionality that's not supported on those targets.
2025-03-10Remove stack overflow handler for cygwin王宇逸-8/+3
2025-03-10Use __xpg_strerror_r on cygwin王宇逸-1/+6