about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2025-04-25Rollup merge of #137653 - tgross35:deprecate-concat_idents, r=workingjubileeMatthias Krüger-0/+2
Deprecate the unstable `concat_idents!` `concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1]. Link: https://github.com/rust-lang/rust/issues/124225 [1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
2025-04-25Rollup merge of #140210 - Berrysoft:cygwin-timedwait, r=joboetMatthias Krüger-1/+4
Work around cygwin issue on condvar timeout This workaround *just works*... Actually I don't quite understand why does it work in such way. With a simple test on Cygwin, it seems that the maximum value of `tv_sec` could be 12899331056917, while the maximum value of `tv_nsec` should be a value floating around 464600000. A larger `timespec` could block the syscall forever. r? `@joboet`
2025-04-24Deprecate the unstable `concat_idents!`Trevor Gross-0/+2
`concat_idents` has been around unstably for a long time, but there is now a better (but still unstable) way to join identifiers using `${concat(...)}` syntax with `macro_metavar_expr_concat`. This resolves a lot of the problems with `concat_idents` and is on a better track toward stabilization, so there is no need to keep both versions around. `concat_idents!` still has a lot of use in the ecosystem so deprecate it before removing, as discussed in [1]. Link: https://github.com/rust-lang/rust/issues/124225 [1]: https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Removing.20.60concat_idents.60
2025-04-24Rollup merge of #140141 - thaliaarchi:env-consts/zkvm, r=joboetMatthias Krüger-9/+11
Move zkVM constants into `sys::env_consts` I missed this in #139868. Its `mod` declaration was removed, but the contents were not moved. r? joboet
2025-04-24Rollup merge of #139450 - NobodyXu:new-api/make-fifo, r=tgross35Matthias Krüger-1/+63
Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo` Tracking issue #139324
2025-04-24Rollup merge of #139307 - xizheyin:issue-139296, r=joboetMatthias Krüger-0/+3
std: Add performance warnings to HashMap::get_disjoint_mut Closes #139296 The `get_disjoint_mut` in `HashMap` also performs a complexity O(n^2) check. So we need to be reminded of that as well. https://github.com/rust-lang/hashbrown/blob/b5b0655a37e156f9798ac8dd7e970d4adba9bf90/src/raw/mod.rs#L1216-L1220
2025-04-24Work around cygwin issue on timeout王宇逸-1/+4
2025-04-23Auto merge of #140180 - ChrisDenton:rollup-5pvs08u, r=ChrisDentonbors-8/+18
Rollup of 7 pull requests Successful merges: - #140142 (Some more graphviz tweaks) - #140146 (Update `compiler_builtins` to 0.1.156) - #140147 (Clean: rename `open_braces` to `open_delimiters` in lexer and move `make_unclosed_delims_error` into `diagnostics.rs`.) - #140160 (Use `is_lang_item` and `as_lang_item` instead of handrolling their logic) - #140163 (Validate extension in `PathBuf::add_extension`) - #140173 (Ping Mara when touching format_args!() internals.) - #140175 (`rc""` more clear error message) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-23Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo`Jiahao XU-1/+63
Tracking issue #139324 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-04-23Document breaking out of a named code blockArtur Roos-0/+27
2025-04-23Rollup merge of #140163 - thaliaarchi:pathbuf-validate-extension, r=ChrisDentonChris Denton-7/+17
Validate extension in `PathBuf::add_extension` The extension is validated in `PathBuf::set_extension`, but not `add_extension`. Fix that. Check for both `/` and `\` path separators on Windows, even when the path is verbatim, since this is logically like `PathBuf::push` which normalizes separators (i.e., keeping the current behavior). `PathBuf::add_extension` is tracked in #127292. r? `@ChrisDenton`
2025-04-23Rollup merge of #140146 - tgross35:update-builtins, r=tgross35Chris Denton-1/+1
Update `compiler_builtins` to 0.1.156 Includes the following changes: * Provide `abort` on AVR [1] [1]: https://github.com/rust-lang/compiler-builtins/pull/830
2025-04-22Rollup merge of #140149 - RalfJung:test_nan, r=tgross35Chris Denton-0/+8
test_nan: ensure the NAN contant is quiet Follow-up to https://github.com/rust-lang/rust/pull/139483 r? ``@tgross35``
2025-04-22Rollup merge of #139617 - Berrysoft:cygwin-posix-spawn, r=joboetChris Denton-2/+6
Use posix_spawn on cygwin r? ``@joboet`` Depends on: - [x] https://github.com/rust-lang/libc/pull/4387 - [x] https://github.com/rust-lang/rust/pull/140081
2025-04-22Validate extension in `PathBuf::add_extension`Thalia Archibald-7/+17
The extension is validated in `PathBuf::set_extension`, but not `add_extension`. Fix that. Check for both / and \ path separators on Windows, even when the path is verbatim, since this is logically like `PathBuf::push` which normalizes separators (i.e., keeping the current behavior).
2025-04-22test_nan: ensure the NAN contant is quietRalf Jung-0/+8
2025-04-22Update `compiler_builtins` to 0.1.156Trevor Gross-1/+1
Includes the following changes: * Provide `abort` on AVR [1] [1]: https://github.com/rust-lang/compiler-builtins/pull/830
2025-04-21Unify owned `Env` types between platformsThalia Archibald-348/+98
Also, update the same pattern of reuse in `sys::args` to match.
2025-04-21Deduplicate unsupported env itemsThalia Archibald-42/+8
2025-04-21Fix `unsafe_op_in_unsafe_fn` for Unix envThalia Archibald-6/+4
2025-04-21Move zkVM constants into `sys::env_consts`Thalia Archibald-9/+11
I missed this in #139868. Its `mod` declaration was removed, but the contents were not moved.
2025-04-21Move `sys::pal::os::Env` into `sys::env`Thalia Archibald-1198/+1228
Although `Env` (as `Vars`), `Args`, path functions, and OS constants are publicly exposed via `std::env`, their implementations are each self-contained. Keep them separate in `std::sys` and make a new module, `sys::env`, for `Env`.
2025-04-22Rollup merge of #140081 - Berrysoft:update-libc-172, r=tgross35Chris Denton-1/+1
Update `libc` to 0.2.172 r? ````@joboet````
2025-04-21Auto merge of #140127 - ChrisDenton:rollup-2kye32h, r=ChrisDentonbors-47/+24
Rollup of 11 pull requests Successful merges: - #134213 (Stabilize `naked_functions`) - #139711 (Hermit: Unify `std::env::args` with Unix) - #139795 (Clarify why SGX code specifies linkage/symbol names for certain statics) - #140036 (Advent of `tests/ui` (misc cleanups and improvements) [4/N]) - #140047 (remove a couple clones) - #140052 (Fix error when an intra doc link is trying to resolve an empty associated item) - #140074 (rustdoc-json: Improve test for auto-trait impls) - #140076 (jsondocck: Require command is at start of line) - #140107 (rustc-dev-guide subtree update) - #140111 (cleanup redundant pattern instances) - #140118 ({B,C}Str: minor cleanup) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-21Rollup merge of #140111 - jogru0:redundant_pattern, r=compiler-errorsChris Denton-1/+1
cleanup redundant pattern instances Just two small code cleanups.
2025-04-21Rollup merge of #139795 - jethrogb:jb/sgx-linkage-comments, r=joboetChris Denton-6/+14
Clarify why SGX code specifies linkage/symbol names for certain statics Specifying linkage/symbol name is solely to ensure a single instance between the `std` crate and its unit tests. Also update the symbol names as items have moved around a bit. The actual name isn't that important, it just needs to be unique. But for debugging it can be useful for it to point to the right place.
2025-04-21Rollup merge of #139711 - thaliaarchi:hermit-args, r=jhprattChris Denton-40/+9
Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in https://github.com/rust-lang/rust/pull/74006 (cc `@euclio)` for Unix and https://github.com/rust-lang/rust/pull/100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
2025-04-21Rollup merge of #140009 - ShE3py:tls-abort, r=thomccChris Denton-2/+6
docs(LocalKey<T>): clarify that T's Drop shouldn't panic Clarify that should a TLS destructor panics, the process will abort. Also, an abort may be obfuscated as the process can be terminated with `SIGSEGV` or [`STATUS_STACK_BUFFER_OVERRUN`](https://devblogs.microsoft.com/oldnewthing/20190108-00/?p=100655) (i.e., `SIGABRT` is not guaranteed), so explicitly prints that the process was aborted. Context: https://users.rust-lang.org/t/status-stack-buffer-overrun-on-windows-without-any-usage-of-unsafe/128417 ``@rustbot`` label -T-compiler
2025-04-21Rollup merge of #139982 - coolreader18:time-doc-tweak, r=jhprattChris Denton-2/+3
SystemTime doc tweaks * Change the `UNIX_EPOCH` link in the `SystemTime` docs to point to the associated constant, not the module level constant. The former seems to be the recommended way to access it, since aiui the only reason the module constant exists in the first place is that associated constants weren't stable yet at the time. * Reword the comment in the `SystemTime` example - "an error occurred!" is a tad misleading; I feel like it implies a system error out of our control while `SystemTimeError` is more of a logic error. I was originally just gonna do the first thing but I noticed the second and figured I may as well. I'm also somewhat surprised that there aren't more in-depth module level docs for `std::time`; they don't even mention `SystemTime` at all. I might make another PR for that but mainly just wanted to flag it.
2025-04-21cleanup redundant pattern instancesJonathan Gruner-1/+1
2025-04-20Use `currently` for futher improvementxizheyin-1/+1
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
2025-04-20Update `libc` to 0.2.172 for std王宇逸-1/+1
2025-04-20std: mention `remove_dir_all` can emit `DirectoryNotEmpty` when concurrently ↵xizheyin-0/+2
written into Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-20Auto merge of #140043 - ChrisDenton:rollup-vwf0s9j, r=ChrisDentonbors-187/+192
Rollup of 8 pull requests Successful merges: - #138934 (support config extensions) - #139091 (Rewrite on_unimplemented format string parser.) - #139753 (Make `#[naked]` an unsafe attribute) - #139762 (Don't assemble non-env/bound candidates if projection is rigid) - #139834 (Don't canonicalize crate paths) - #139868 (Move `pal::env` to `std::sys::env_consts`) - #139978 (Add citool command for generating a test dashboard) - #139995 (Clean UI tests 4 of n) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-19Rollup merge of #139868 - thaliaarchi:move-env-consts-pal, r=joboetChris Denton-187/+192
Move `pal::env` to `std::sys::env_consts` Combine the `std::env::consts` platform implementations as a single file. Use the Unix file as the base, since it has 28 entries, and fold the 8 singleton platforms into it. The Unix file was roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms. I'd prefer to have no fallback implementation, as I consider it a bug; however TEEOS, Trusty, and Xous have no definitions here. Since they otherwise have `pal` abstractions, that indicates that there are several platforms without `pal` abstractions which are also missing here. To support unsupported, create a little macro to handle the fallback case and not introduce ordering between the `cfg`s like `cfg_if!`. I've named the module `std::sys::env_consts`, because they are used in `std::env::consts` and I intend to use the name `std::sys::env` for the combination of `Args` and `Vars`. cc `@joboet` `@ChrisDenton` Tracked in #117276.
2025-04-18Handle unsupported fallbackThalia Archibald-1/+28
2025-04-18Combine env consts into std::sys::env_constsThalia Archibald-95/+71
2025-04-18Sort Unix env constants alphabetically by target_osThalia Archibald-98/+100
They were roughly grouped into Linux, Apple, BSD, and everything else, roughly in alphabetical order. Alphabetically order them to make it easier to maintain and discard the Unix-specific groups to generalize it to all platforms.
2025-04-18std: Use fstatat() on illumosPatrick Mooney-3/+6
2025-04-18Auto merge of #139996 - matthiaskrgr:rollup-0nka2hw, r=matthiaskrgrbors-1/+12
Rollup of 7 pull requests Successful merges: - #138528 (deref patterns: implement implicit deref patterns) - #139393 (rustdoc-json: Output target feature information) - #139553 (sync::mpsc: prevent double free on `Drop`) - #139615 (Remove `name_or_empty`) - #139853 (Disable combining LLD with external llvm-config) - #139913 (rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)) - #139942 (Ignore aix for tests/ui/erros/pic-linker.rs) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-18rtprintpanic: clarify that the error is aborting the processLieselotte-1/+1
2025-04-18LocalKey<T>: document that the dtor should not panicLieselotte-1/+5
2025-04-18Rollup merge of #139934 - tgross35:update-builtins, r=tgross35Matthias Krüger-1/+1
Update `compiler-builtins` to 0.1.155 Includes the following changes: * Replace `#[naked]` with `#[unsafe(naked)]` [1] [2] * Replace `bl!` with `asm_sym` [3] [1]: https://github.com/rust-lang/compiler-builtins/pull/817 [2]: https://github.com/rust-lang/compiler-builtins/pull/821 [3]: https://github.com/rust-lang/compiler-builtins/pull/820 try-job: armhf-gnu try-job: aarch64-apple try-job: dist-apple-various
2025-04-18Rollup merge of #139553 - petrosagg:channel-double-free, r=RalfJung,tgross35Matthias Krüger-1/+12
sync::mpsc: prevent double free on `Drop` This PR is fixing a regression introduced by #121646 that can lead to a double free when dropping the channel. The details of the bug can be found in the corresponding crossbeam PR https://github.com/crossbeam-rs/crossbeam/pull/1187
2025-04-17Update `compiler-builtins` to 0.1.155Trevor Gross-1/+1
Includes the following changes: * Replace `#[naked]` with `#[unsafe(naked)]` [1] [2] * Replace `bl!` with `asm_sym` [3] [1]: https://github.com/rust-lang/compiler-builtins/pull/817 [2]: https://github.com/rust-lang/compiler-builtins/pull/821 [3]: https://github.com/rust-lang/compiler-builtins/pull/820
2025-04-17Be more specific about the error in the SystemTime exampleNoa-2/+2
2025-04-17Point UNIX_EPOCH to associated constant in SystemTime docsNoa-0/+1
2025-04-17Rollup merge of #139667 - 1c3t3a:remove-no-sanitize, r=m-ou-seMatthias Krüger-41/+0
cfi: Remove #[no_sanitize(cfi)] for extern weak functions Previously (https://github.com/rust-lang/rust/pull/115200, https://github.com/rust-lang/rust/pull/138002), we added `#[no_sanitize(cfi)]` to all code paths that call to a weakly linked function. In https://github.com/rust-lang/rust/pull/138349 we fixed the root cause for this issue, which means we can now remove the corresponding attributes. r? `@rcvalle`
2025-04-16Also remove the no_sanitize feature for stdBastian Kersting-1/+0
2025-04-15Add warning comment to `Take::get_ref` and `Chain::get_ref`Josh Triplett-0/+8
The methods `Take::get_mut` and `Chain::get_mut` include comments warning about modifying the I/O state of the underlying reader. However, many readers (e.g. `File`) allow I/O using a shared reference (e.g. `&File`). So, add the same caveat to the `get_ref` methods.