about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2024-02-28add platform-specific function to get the error number for HermitOSStefan Lankes-6/+6
Extending `std` to get the last error number for HermitOS. HermitOS is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-02-28std: move thread local implementation to `sys`joboet-3/+4
2024-02-28Rollup merge of #121691 - ↵Guillaume Gomez-1/+1
janstarke:handle-missing-creation-time-as-unsupported, r=cuviper handle unavailable creation time as `io::ErrorKind::Unsupported`
2024-02-28Rollup merge of #120051 - riverbl:os-str-display, r=m-ou-seGuillaume Gomez-9/+72
Add `display` method to `OsStr` Add `display` method to `OsStr` for lossy display of an `OsStr` which may contain invalid unicode. Invalid Unicode sequences are replaced with `U+FFFD REPLACEMENT CHARACTER`. This change also makes the `std::ffi::os_str` module public (see https://github.com/rust-lang/libs-team/issues/326#issuecomment-1894160023). - ACP: https://github.com/rust-lang/libs-team/issues/326 - Tracking issue: #120048
2024-02-28remove Mutex::unlockHTGAzureX1212.-20/+0
2024-02-27Implement junction_pointChris Denton-81/+86
2024-02-27Auto merge of #119616 - rylev:wasm32-wasi-preview2, r=petrochenkov,m-ou-sebors-124/+223
Add a new `wasm32-wasi-preview2` target This is the initial implementation of the MCP https://github.com/rust-lang/compiler-team/issues/694 creating a new tier 3 target `wasm32-wasi-preview2`. That MCP has been seconded and will most likely be approved in a little over a week from now. For more information on the need for this target, please read the [MCP](https://github.com/rust-lang/compiler-team/issues/694). There is one aspect of this PR that will become insta-stable once these changes reach a stable compiler: * A new `target_family` named `wasi` is introduced. This target family incorporates all wasi targets including `wasm32-wasi` and its derivative `wasm32-wasi-preview1-threads`. The difference between `target_family = wasi` and `target_os = wasi` will become much clearer when `wasm32-wasi` is renamed to `wasm32-wasi-preview1` and the `target_os` becomes `wasm32-wasi-preview1`. You can read about this target rename in [this MCP](https://github.com/rust-lang/compiler-team/issues/695) which has also been seconded and will hopefully be officially approved soon. Additional technical details include: * Both `std::sys::wasi_preview2` and `std::os::wasi_preview2` have been created and mostly use `#[path]` annotations on their submodules to reach into the existing `wasi` (soon to be `wasi_preview1`) modules. Over time the differences between `wasi_preview1` and `wasi_preview2` will grow and most like all `#[path]` based module aliases will fall away. * Building `wasi-preview2` relies on a [`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk) in the same way that `wasi-preview1` does (one must include a `wasi-root` path in the `Config.toml` pointing to sysroot included in the wasi-sdk). The target should build against [wasi-sdk v21](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-21) without modifications. However, the wasi-sdk itself is growing [preview2 support](https://github.com/WebAssembly/wasi-sdk/pull/370) so this might shift rapidly. We will be following along quickly to make sure that building the target remains possible as the wasi-sdk changes. * This requires a [patch to libc](https://github.com/rylev/rust-libc/tree/wasm32-wasi-preview2) that we'll need to land in conjunction with this change. Until that patch lands the target won't actually build.
2024-02-27handle unavailable creation time as `io::ErrorKind::Unsupported`Jan Starke-1/+1
2024-02-27Auto merge of #119636 - devnexen:linux_tcp_defer_accept, r=m-ou-sebors-0/+93
os::net: expanding TcpStreamExt for Linux with `tcp_deferaccept`. allows for socket to process only when there is data to process, the option sets a number of seconds until the data is ready.
2024-02-27Rename wasm32-wasi-preview2 to wasm32-wasip2Ryan Levick-8/+8
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27Add the wasm32-wasi-preview2 targetRyan Levick-124/+223
Signed-off-by: Ryan Levick <me@ryanlevick.com>
2024-02-27Test getting the OS thread nameChris Denton-0/+19
2024-02-27Use the OS thread name by default for the current threadChris Denton-3/+78
2024-02-27Auto merge of #121655 - matthiaskrgr:rollup-qpx3kks, r=matthiaskrgrbors-4/+4
Rollup of 4 pull requests Successful merges: - #121598 (rename 'try' intrinsic to 'catch_unwind') - #121639 (Update books) - #121648 (Update Vec and String `{from,into}_raw_parts`-family docs) - #121651 (Properly emit `expected ;` on `#[attr] expr`) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-27Rollup merge of #121598 - RalfJung:catch_unwind, r=oli-obkMatthias Krüger-4/+4
rename 'try' intrinsic to 'catch_unwind' The intrinsic has nothing to do with `try` blocks, and corresponds to the stable `catch_unwind` function, so this makes a lot more sense IMO. Also rename Miri's special function while we are at it, to reflect the level of abstraction it works on: it's an unwinding mechanism, on which Rust implements panics.
2024-02-26Auto merge of #121516 - RalfJung:platform-intrinsics-begone, r=oli-obkbors-1/+1
remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsics `@Amanieu` `@workingjubilee` I don't think there is any reason these need to be "special"? The [original RFC](https://rust-lang.github.io/rfcs/1199-simd-infrastructure.html) indicated eventually making them stable, but I think that is no longer the plan, so seems to me like we can clean this up a bit. Blocked on https://github.com/rust-lang/stdarch/pull/1538, https://github.com/rust-lang/rust/pull/121542.
2024-02-26change std::process to drop supplementary groups based on CAP_SETGIDElliot Roberts-3/+18
2024-02-26fix race between block initialization and receiver disconnectionIbraheem Ahmed-2/+2
2024-02-26Remove _tls_used trickery unless neededChris Denton-5/+2
2024-02-26Use volatile to make `p_thread_callback` usedChris Denton-17/+11
2024-02-26Win10: Use GetSystemTimePreciseAsFileTime directlyChris Denton-0/+6
2024-02-26rename 'try' intrinsic to 'catch_unwind'Ralf Jung-4/+4
2024-02-26Fill in Read::read_buf for &StdinDavid Tolnay-0/+3
2024-02-26Fix stable feature name and stabilization version of Read for &StdinDavid Tolnay-1/+1
2024-02-26Auto merge of #121317 - ChrisDenton:win10-sync, r=Mark-Simulacrumbors-106/+154
Always use WaitOnAddress on Win10+ `WaitOnAddress` and `WakeByAddressSingle` are always available since Windows 8 so they can now be used without needing to delay load. I've also moved the Windows 7 thread parking fallbacks into a separate sub-module.
2024-02-25Auto merge of #121591 - matthiaskrgr:rollup-8wfhh3v, r=matthiaskrgrbors-0/+0
Rollup of 9 pull requests Successful merges: - #119590 (Stabilize `cfg_target_abi`) - #120805 (make non-PartialEq-typed consts as patterns a hard error) - #121060 (Add newtypes for bool fields/params/return types) - #121284 (Add test cases for inlining compiler-private items) - #121324 (pattern_analysis: factor out unspecialization) - #121409 (Prevent cycle in implied predicates computation) - #121513 (Fix sgx unit test compilation) - #121570 (Make most bootstrap step types !Copy) - #121586 (Don't use `unwrap()` in `ArrayIntoIter` lint when typeck fails) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-25Rollup merge of #121513 - nshyrei:fix_tests_module, r=cuviperMatthias Krüger-0/+0
Fix sgx unit test compilation Fixes a compilation error: ``` error[E0583]: file not found for module `tests` --> library/std/src/sys/locks/rwlock/sgx.rs:2:1 | 2 | mod tests; | ^^^^^^^^^^ | = help: to create the module `tests`, create file "library/std/src/sys/locks/rwlock/sgx/tests.rs" or "library/std/src/sys/locks/rwlock/sgx/tests/mod.rs" = note: if there is a `mod tests` elsewhere in the crate already, import it with `use crate::...` instead For more information about this error, try `rustc --explain E0583`. error: could not compile `std` (lib test) due to 1 previous error` ``` When running command: ``` `TF_BUILD=True RUST_TEST_THREADS=1 ./x.py test --stage 1 "library/std" tests/assembly tests/run-make --target=x86_64-fortanix-unknown-sgx --no-doc --exclude src/tools/linkchecker --exclude src/tools/rust-demangler --no-fail-fast 2>&1 ``` The fix is done by moving a file to the location suggested by the compiler. The issue was introduced by PR: https://github.com/rust-lang/rust/pull/121177
2024-02-25Windows: Use ProcessPrng for random keysChris Denton-44/+28
2024-02-25remove platform-intrinsics ABI; make SIMD intrinsics be regular intrinsicsRalf Jung-1/+1
2024-02-25Auto merge of #117107 - zachs18:mapped-mutex-guard, r=Amanieubors-4/+985
Implement `MappedMutexGuard`, `MappedRwLockReadGuard`, and `MappedRwLockWriteGuard`. ACP: https://github.com/rust-lang/libs-team/issues/260 Tracking issue: https://github.com/rust-lang/rust/issues/117108 <details> <summary> (Outdated) </summary> `MutexState`/`RwLockState` structs ~~Having `sys::(Mutex|RwLock)` and `poison::Flag` as separate fields in the `Mutex`/`RwLock` would require `MappedMutexGuard`/`MappedRwLockWriteGuard` to hold an additional pointer, so I combined the two fields into a `MutexState`/`RwLockState` struct. This should not noticeably affect perf or layout, but requires an additional field projection when accessing the former `.inner` or `.poison` fields (now `.state.inner` and `.state.poison`).~~ If this is not desired, then `MappedMutexGuard`/`MappedRwLockWriteGuard` can instead hold separate pointers to the two fields. </details> The doc-comments are mostly copied from the existing `*Guard` doc-comments, with some parts from `lock_api::Mapped*Guard`'s doc-comments. Unresolved question: Are more tests needed?
2024-02-24Rollup merge of #121556 - GrigorenkoPV:addr_of, r=NilstriebMatthias Krüger-62/+70
Use `addr_of!` As per https://github.com/rust-lang/rust/pull/121303#discussion_r1500954662
2024-02-24Rollup merge of #121530 - wgslr:master, r=Mark-SimulacrumMatthias Krüger-1/+1
Fix incorrect doc of ScopedJoinHandle::is_finished Fixes the explanation how to use `is_finished` to achieve a non-blocking join. The updated version matches the documentation of the non-scoped JoinHandle::is_finished.
2024-02-24library: use `addr_of!`Pavel Grigorenko-62/+70
2024-02-23Apply suggestions from code reviewzachs18-3/+3
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2024-02-24Fix incorrect doc of ScopedJoinHandle::is_finishedWojciech Geisler-1/+1
Fixes the explanation how to use is_finished to achieve a non-blocking join. The updated version matches the documentation of the non-scoped JoinHandle::is_finished.
2024-02-23Auto merge of #119536 - Jules-Bertholet:const-barrier, r=dtolnaybors-1/+3
Make `Barrier::new()` const I guess this was just missed in #97791? `@rustbot` label T-libs-api -T-libs
2024-02-23std: make `ReentrantLock` publicjoboet-207/+375
2024-02-23Auto merge of #121303 - GrigorenkoPV:static_mut_refs, r=oli-obk,RalfJungbors-5/+0
Get rid of some `#![allow(static_mut_refs)]`
2024-02-23Auto merge of #121514 - matthiaskrgr:rollup-5f0vhv7, r=matthiaskrgrbors-2/+2
Rollup of 6 pull requests Successful merges: - #120742 (mark `min_exhaustive_patterns` as complete) - #121470 (Don't ICE on anonymous struct in enum variant) - #121492 (coverage: Rename `is_closure` to `is_hole`) - #121495 (remove repetitive words) - #121498 (Make QNX/NTO specific "timespec capping" public to crate::sys) - #121510 (lint-overflowing-ops: unify cases and remove redundancy) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-23moved tests fileNikitaShyrei-0/+0
2024-02-23Get rid of some `#[allow(static_mut_refs)]`Pavel Grigorenko-5/+0
2024-02-23Auto merge of #121454 - reitermarkus:generic-nonzero-library, r=dtolnaybors-12/+12
Use generic `NonZero` everywhere in `library`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 Use generic `NonZero` everywhere (except stable examples). r? `@dtolnay`
2024-02-23Make timespec capping public to crate::sysFlorian Bartels-2/+2
It is used in: - `library/std/src/sys/locks/condvar/pthread.rs` - `library/std/src/sys/pal/unix/thread_parking/pthread.rs`
2024-02-22std support for wasm32 panic=unwindNoa-4/+4
2024-02-22Add `rustc_confusables` annotations to some stdlib APIsEsteban Küber-0/+9
Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` #59450
2024-02-22Use generic `NonZero` everywhere in `std`.Markus Reiter-12/+12
2024-02-22remove potentially misleading sentence about libc::accessMarc Schoolderman-2/+1
2024-02-22Add std::ffi::c_str modulesltdk-6/+46
2024-02-22Auto merge of #117174 - Ayush1325:uefi-stdio-improve, r=workingjubileebors-37/+94
Improve UEFI stdio Fixed some things suggested in last PR: #116207 cc `@dvdhrm` cc `@nicholasbishop`
2024-02-21Always use WaitOnAddress on Win10+Chris Denton-106/+154