about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-09-03replace placeholder versionBoxy-1/+1
2024-09-03Win: Open dir for sync access in remove_dir_allChris Denton-3/+12
2024-09-03More robust extension checkingChris Denton-6/+24
2024-09-03Port std library to RTEMSJan Sommer-10/+463
2024-09-03Rollup merge of #129916 - tshepang:basic-usage, r=ChrisDentonMatthias Krüger-36/+0
process.rs: remove "Basic usage" text where not useful Is not useful because just a single example is given.
2024-09-03Rollup merge of #129913 - saethlin:l4re-read-buf, r=NoratriebMatthias Krüger-0/+4
Add missing read_buf stub for x86_64-unknown-l4re-uclibc Before this PR, `x check library/std --target x86_64-unknown-l4re-uclibc` will fail with ``` error[E0599]: no method named `read_buf` found for struct `Socket` in the current scope --> std/src/os/unix/net/stream.rs:598:16 | 598 | self.0.read_buf(buf) | ^^^^^^^^ | ::: std/src/sys/pal/unix/l4re.rs:23:5 | 23 | pub struct Socket(FileDesc); | ----------------- method `read_buf` not found for this struct | = help: items from traits can only be used if the trait is implemented and in scope ``` This target doesn't have a maintainer to cc.
2024-09-03Rollup merge of #129885 - cuishuang:master, r=scottmcmMatthias Krüger-1/+1
chore: remove repetitive words
2024-09-03Rollup merge of #129800 - ChrisDenton:remove-dir-all2, r=AmanieuMatthias Krüger-169/+253
Move the Windows remove_dir_all impl into a module and make it more race resistant This attempts to make the Windows implementation of `remove_dir_all` easier to understand and work with by separating out different concerns into their own functions. The code is mostly the same as before just moved around. There are some changes to make it more robust against races (e.g. two calls to `remove_dir_all` running concurrently). The module level comment explains the issue. try-job: x86_64-msvc try-job: i686-msvc
2024-09-02process.rs: remove "Basic usage" text where not usefulTshepang Mbambo-36/+0
Is not useful because just a single example is given.
2024-09-02Rollup merge of #129907 - saethlin:solid-io-error, r=WaffleLapkinMatthias Krüger-1/+1
Fix compile error in solid's remove_dir_all Before this PR, `x check library/std --target=aarch64-kmc-solid_asp3` will fail with: ``` error[E0382]: use of partially moved value: `result` --> std/src/sys/pal/solid/fs.rs:544:20 | 541 | if let Err(err) = result | --- value partially moved here ... 544 | return result; | ^^^^^^ value used here after partial move | = note: partial move occurs because value has type `io::error::Error`, which does not implement the `Copy` trait help: borrow this binding in the pattern to avoid moving the value | 541 | if let Err(ref err) = result | +++ ``` cc `@kawadakk` I think this will clear up https://solid-rs.github.io/toolstate/ :)
2024-09-02Rollup merge of #129890 - alex:patch-1, r=workingjubileeMatthias Krüger-1/+1
Remove stray word in a comment
2024-09-02Add missing read_buf stub for x86_64-unknown-l5re-uclibcBen Kimock-0/+4
2024-09-02Fix compile error in solid's remove_dir_allBen Kimock-1/+1
2024-09-02Remove stray word in a commentAlex Gaynor-1/+1
2024-09-02Auto merge of #129873 - matthiaskrgr:rollup-bv849ud, r=matthiaskrgrbors-5/+5
Rollup of 9 pull requests Successful merges: - #127474 (doc: Make block of inline Deref methods foldable) - #129678 (Deny imports of `rustc_type_ir::inherent` outside of type ir + new trait solver) - #129738 (`rustc_mir_transform` cleanups) - #129793 (add extra linebreaks so rustdoc can identify the first sentence) - #129804 (Fixed some typos in the standard library documentation/comments) - #129837 (Actually parse stdout json, instead of using hacky contains logic.) - #129842 (Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf) - #129843 (Mark myself as on vacation for triagebot) - #129858 (Replace walk with visit so we dont skip outermost expr kind in def collector) Failed merges: - #129777 (Add `unreachable_pub`, round 4) - #129868 (Remove kobzol vacation status) r? `@ghost` `@rustbot` modify labels: rollup
2024-09-02chore: remove repetitive wordscuishuang-1/+1
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-02Rollup merge of #129804 - ranger-ross:fixed-documentation-typos, r=NoratriebMatthias Krüger-5/+5
Fixed some typos in the standard library documentation/comments I spent some time to fix a few typos in `library/std` and `library/core`
2024-09-02Auto merge of #129063 - the8472:cold-opt-size, r=Amanieubors-2/+9
Apply size optimizations to panic machinery and some cold functions * std dependencies gimli and addr2line are now built with opt-level=s * various panic-related methods and `#[cold]` methods are now marked `#[optimize(size)]` Panics should be cold enough that it doesn't make sense to optimize them for speed. The only tradeoff here is if someone does a lot of backtrace captures (without panics) and printing then the opt-level change might impact their perf. Seems to be the first use of the optimize attribute. Tracking issue #54882
2024-09-01Auto merge of #127897 - nyurik:add-qnx-70-target, r=saethlinbors-5/+8
add `aarch64_unknown_nto_qnx700` target - QNX 7.0 support for aarch64le This backports the QNX 7.1 aarch64 implementation to 7.0. * [x] required `-lregex` disabled, see https://github.com/rust-lang/libc/pull/3775 (released in libc 0.2.156) * [x] uses `libgcc.a` instead of `libgcc_s.so` (7.0 used ancient GCC 5.4 which didn't have gcc_s) * [x] a fix in `backtrace` crate to support stack traces https://github.com/rust-lang/backtrace-rs/pull/648 This PR bumps libc dependency to 0.2.158 CC: to the folks who did the [initial implementation](https://doc.rust-lang.org/rustc/platform-support/nto-qnx.html): `@flba-eb,` `@gh-tr,` `@jonathanpallant,` `@japaric` # Compile target ```bash # Configure qcc build environment source _path_/_to_/qnx7.0/qnxsdp-env.sh # Tell rust to use qcc when building QNX 7.0 targets export build_env=' CC_aarch64-unknown-nto-qnx700=qcc CFLAGS_aarch64-unknown-nto-qnx700=-Vgcc_ntoaarch64le_cxx CXX_aarch64-unknown-nto-qnx700=qcc AR_aarch64_unknown_nto_qnx700=ntoaarch64-ar' # Build rust compiler, libs, and the remote test server env $build_env ./x.py build \ --target x86_64-unknown-linux-gnu,aarch64-unknown-nto-qnx700 \ rustc library/core library/alloc library/std src/tools/remote-test-server rustup toolchain link stage1 build/host/stage1 ``` # Compile "hello world" ```bash source _path_/_to_/qnx7.0/qnxsdp-env.sh cargo new hello_world cd hello_world cargo +stage1 build --release --target aarch64-unknown-nto-qnx700 ``` # Configure a remote for testing Do this from a new shell - we will need to run more commands in the previous one. I ran into these two issues, and found some workarounds. * Temporary dir might not work properly * Default `remote-test-server` has issues binding to an address ``` # ./remote-test-server starting test server thread 'main' panicked at src/tools/remote-test-server/src/main.rs:175:29: called `Result::unwrap()` on an `Err` value: Os { code: 249, kind: AddrNotAvailable, message: "Can't assign requested address" } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Specifying `--bind` param actually fixes that, and so does setting `TMPDIR` properly. ```bash # Copy remote-test-server to remote device. You may need to use sftp instead. # ATTENTION: Note that the path is different from the one in the remote testing documentation for some reason scp ./build/x86_64-unknown-linux-gnu/stage1-tools-bin/remote-test-server qnxdevice:/path/ # Run ssh with port forwarding - so that rust tester can connect to the local port instead ssh -L 12345:127.0.0.1:12345 qnxdevice # on the device, run rm -rf tmp && mkdir -p tmp && TMPDIR=$PWD/tmp ./remote-test-server --bind 0.0.0.0:12345 ``` # Run test suit Assume all previous environment variables are still set, or re-init them ```bash export TEST_DEVICE_ADDR="localhost:12345" # tidy needs to be skipped due to using un-published libc dependency export exclude_tests=' --exclude src/bootstrap --exclude src/tools/error_index_generator --exclude src/tools/linkchecker --exclude src/tools/tidy --exclude tests/ui-fulldeps --exclude rustc --exclude rustdoc --exclude tests/run-make-fulldeps' env $build_env ./x.py test $exclude_tests --stage 1 --target aarch64-unknown-nto-qnx700 ``` try-job: dist-x86_64-msvc
2024-08-31Move remove_dir_all impl into a moduleChris Denton-169/+253
2024-08-31Rollup merge of #129754 - alexcrichton:fix-wasi-long-sleep, r=workingjubileeMatthias Krüger-30/+31
wasi: Fix sleeping for `Duration::MAX` This commit fixes an assert in the WASI-specific implementation of thread sleep to ensure that sleeping for a very large period of time blocks instead of panicking. This can come up when testing programs that sleep "forever", for example. I'll note that I haven't included a test for this since it's sort of difficult to test. I've tested this locally though that long sleeps do indeed block and short sleeps still only sleep for a short amount of time.
2024-08-31Rollup merge of #129675 - lolbinarycat:bufreader_peek_unsized, r=workingjubileeMatthias Krüger-0/+2
allow BufReader::peek to be called on unsized types #128405
2024-08-31Fixed some typos in the standard library documentation/commentsranger-ross-5/+5
2024-08-30Squashed `aarch64_unknown_nto_qnx700` supportYuri Astrakhan-5/+8
2024-08-29wasi: Fix sleeping for `Duration::MAX`Alex Crichton-30/+31
This commit fixes an assert in the WASI-specific implementation of thread sleep to ensure that sleeping for a very large period of time blocks instead of panicking. This can come up when testing programs that sleep "forever", for example.
2024-08-28Rollup merge of #129683 - RalfJung:copysign, r=thomccJubilee-12/+32
copysign with sign being a NaN can have non-portable results Follow-up to https://github.com/rust-lang/rust/pull/129559. Cc ```@tgross35``` ```@beetrees``` There's no portable variant we can recommend instead here, is there? Something with a semantics like "if `sign` is a NaN, then return `self` unaltered, otherwise return `self` with the sign changed to that of `sign`"?
2024-08-28Rollup merge of #129401 - ↵Jubilee-1/+0
workingjubilee:partial-initialization-of-stabilization, r=dtolnay,joboet Partially stabilize `feature(new_uninit)` Finished comment period: https://github.com/rust-lang/rust/issues/63291#issuecomment-2183022955 The following API has been stabilized from https://github.com/rust-lang/rust/issues/63291 ```rust impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} } impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} } impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} } impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} } impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} } impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} } impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} } impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} } impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} } impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} } impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} } impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} } ``` The remaining API is split between new issues - `new_zeroed_alloc`: https://github.com/rust-lang/rust/issues/129396 - `box_uninit_write`: https://github.com/rust-lang/rust/issues/129397 All relevant code is thus either stabilized or split out of that issue, so this closes #63291 as, with the FCP concluded, that issue has served its purpose. try-job: x86_64-rust-for-linux
2024-08-28Rollup merge of #129378 - goffrie:patch-3, r=ChrisDentonJubilee-13/+9
Clean up cfg-gating of ProcessPrng extern This removes a bit of duplication and is consistent with how `api-ms-win-core-synch-l1-2-0` externs are imported.
2024-08-28add guarantee about remove_dir and remove_file error kindsbinarycat-0/+10
approved in ACP https://github.com/rust-lang/libs-team/issues/433
2024-08-28allow BufReader::peek to be called on unsized typesbinarycat-0/+2
2024-08-28copysign with sign being a NaN is non-portableRalf Jung-12/+32
2024-08-27library: Stabilize new_uninit for Box, Rc, and ArcJubilee Young-1/+0
A partial stabilization that only affects: - AllocType<T>::new_uninit - AllocType<T>::assume_init - AllocType<[T]>::new_uninit_slice - AllocType<[T]>::assume_init where "AllocType" is Box, Rc, or Arc
2024-08-27Rollup merge of #129581 - RalfJung:exit, r=joshtriplettMatthias Krüger-0/+9
exit: explain our expectations for the exit handlers registered in a Rust program This documents the position of ``@Amanieu`` and others in https://github.com/rust-lang/rust/issues/126600: a library with an atexit handler that destroys state that other threads could still be working on is buggy. We do not consider it acceptable for a library to say "you must call the following cleanup function before exiting from `main` or calling `exit`". I don't know if this is established ``@rust-lang/libs-api`` consensus so I presume this will have to go through FCP. Given that Rust supports concurrency, I don't think there is any way to write a sound Rust wrapper around a library that has such a required cleanup function: even if we made `exit` unsafe, and the Rust wrapper used the scope-with-callback approach to ensure it can run cleanup code before returning from the wrapper (like `thread::scope`), one could still call this wrapper in a second thread and then return from `main` while the wrapper runs. Making this sound would require `std` to provide a way to "block" returning from `main`, so that while the wrapper runs returning from `main` waits until the wrapper is done... that just doesn't seem feasible. The `exit` docs do not seem like the best place to document this, but I also couldn't think of a better one.
2024-08-27Auto merge of #128134 - joboet:move_pal_alloc, r=cupiverbors-146/+78
std: move allocators to `sys` Part of #117276.
2024-08-27std: move allocators to `sys`joboet-146/+78
2024-08-27Rollup merge of #129559 - RalfJung:float-nan-semantics, r=thomccTrevor Gross-20/+20
float types: document NaN bit pattern guarantees Part of https://github.com/rust-lang/rust/issues/128288: document the guarantees we make for NaN bit patterns. Cc ``@tgross35``
2024-08-26Rollup merge of #129588 - hermit-os:sleep-micros, r=workingjubileeMatthias Krüger-1/+4
pal/hermit: correctly round up microseconds in `Thread::sleep` This fixes the Hermit-related part of https://github.com/rust-lang/rust/issues/129212 and thus the whole issue, since ESP-IDF is already fixed, as far as I understand. Fixes https://github.com/rust-lang/rust/issues/129212 r? `@workingjubilee` CC: `@stlankes`
2024-08-26also update copysign docsRalf Jung-20/+20
2024-08-26pal/hermit: saturate `usleep` microseconds at `u64::MAX`Martin Kröning-1/+2
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-08-25pal/hermit: correctly round up microseconds in `Thread::sleep`Martin Kröning-1/+3
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-08-25exit: explain our expectations for the exit handlers registered in a Rust ↵Ralf Jung-0/+9
program
2024-08-25Rollup merge of #129416 - workingjubilee:partial-move-from-stabilization, ↵Matthias Krüger-0/+1
r=dtolnay library: Move unstable API of new_uninit to new features - `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-24Rollup merge of #129501 - RalfJung:miri-rust-backtrace, r=NoratriebMatthias Krüger-1/+1
panicking: improve hint for Miri's RUST_BACKTRACE behavior Should help with https://github.com/rust-lang/miri/issues/3838
2024-08-24panicking: improve hint for Miri's RUST_BACKTRACE behaviorRalf Jung-1/+1
2024-08-23library: Move unstable API of new_uninit to new featuresJubilee Young-0/+1
- `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2024-08-23Rollup merge of #127623 - lolbinarycat:fix_remove_dir_all, r=AmanieuMatthias Krüger-36/+91
fix: fs::remove_dir_all: treat internal ENOENT as success fixes #127576 try-job: test-various
2024-08-22fix: fs::remove_dir_all: treat ENOENT as successbinarycat-36/+91
fixes #127576 windows implementation still needs some work
2024-08-22Update chown help with a link and adding cap warningPeter Gervai-1/+2
Linked to chown(2) manpage on the web which expands on chown call behaviour.
2024-08-22Expand std::os::unix::fs::chown() doc with a warningPeter Gervai-0/+4
Include warning about losing setuid/gid when chowning, per POSIX.
2024-08-22Rollup merge of #128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe, ↵Matthias Krüger-18/+24
r=tgross35 WASI: forbid `unsafe_op_in_unsafe_fn` for `std::{os, sys}` Part of https://github.com/rust-lang/rust/issues/127747 for WASI try-job: test-various