about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2024-08-10Update std and compilerNadrieril-1/+1
2024-08-09doc: std::env::var: Returns None for names with '=' or NUL byteEvan Jones-5/+8
The documentation incorrectly stated that std::env::var could return an error for variable names containing '=' or the NUL byte. Copy the correct documentation from var_os. var_os was fixed in Commit 8a7a665, Pull Request #109894, which closed Issue #109893. This documentation was incorrectly added in commit f2c0f292, which replaced a panic in var_os by returning None, but documented the change as "May error if ...". Reference the specific error values and link to them.
2024-08-09Rollup merge of #128859 - MinxuanZ:mips-sig, r=AmanieuMatthias Krüger-0/+13
Fix the name of signal 19 in library/std/src/sys/pal/unix/process/process_unix/tests.rs for mips/sparc linux relate to #128816
2024-08-09Rollup merge of #128817 - biabbas:vxworks_update, r=tgross35Matthias Krüger-23/+13
VxWorks code refactored 1. Extern TaskNameSet as minimum supported version of os is VxWorks 7 which would have taskNameSet 2. Vx_TASK_NAME_LEN is 31 on VxWorks7, defined variable res. 3. Add unsafe blocks on Non::Zero usage in available_parallelism() 4. Update vxworks docs. r? `@tgross35` cc `@devnexen`
2024-08-09Add windows-targets crate to std's sysrootChris Denton-42/+5
2024-08-09Rollup merge of #128824 - GuillaumeGomez:update-compiler-builtins, r=AmanieuMatthias Krüger-1/+1
Update compiler-builtins version to 0.1.118 r? `@Amanieu`
2024-08-09VxWorks: Add safety comment for vxCpuEnabledGetB I Mohammed Abbas-1/+1
Co-authored-by: Trevor Gross <t.gross35@gmail.com>
2024-08-09delete spacemonstercatss-2/+2
2024-08-09fix formatmonstercatss-4/+6
2024-08-09[SPARC] fix the name of signal 19 in sparc archMin-1/+9
2024-08-09[MIPS] fix the name of signal 19 in mipsMin-0/+3
2024-08-09Rollup merge of #128818 - RalfJung:std-miri-floats, r=tgross35Matthias Krüger-5/+14
std float tests: special-case Miri in feature detection Quick work-around to fix miri-test-libstd failures. r? ``@tgross35``
2024-08-09Rollup merge of #128640 - RalfJung:rwlock-macos-miri, r=joboetMatthias Krüger-0/+4
rwlock: disable 'frob' test in Miri on macOS Due to https://github.com/rust-lang/rust/issues/121950, Miri will sometimes complain about this test on macOS. Better disable the test, as otherwise it can fail for unrelated PRs. r? ``@joboet``
2024-08-08Update compiler-builtins version to 0.1.118Guillaume Gomez-1/+1
2024-08-08std float tests: special-case Miri in feature detectionRalf Jung-5/+14
also fix some cfg logic
2024-08-08Vxworks: Extern taskNameSet and fix build errorsB I Mohammed Abbas-20/+8
2024-08-08rwlock: disable 'frob' test in Miri on macOSRalf Jung-0/+4
2024-08-08Fix VxWorks available parallelism: Move nonzero::uncheked into unsafe blockB I Mohammed Abbas-3/+5
2024-08-07Rollup merge of #128800 - clarfonthey:core-pattern-type, r=compiler-errorsTrevor Gross-1/+1
Add tracking issue to core-pattern-type While the actual `pattern_types` feature flag has an issue assigned, the exported macro and its module do not. cc #123646
2024-08-07Rollup merge of #128691 - tgross35:update-builtins, r=AmanieuTrevor Gross-1/+1
Update `compiler-builtins` to 0.1.117 This includes [1] which means we can remove the (nonworking) configuration of `no-f16-f128`. Fixes https://github.com/rust-lang/rust/issues/128401. [1]: https://github.com/rust-lang/compiler-builtins/pull/652 try-job: dist-various-1
2024-08-07Add tracking issue to core-pattern-typeltdk-1/+1
2024-08-06Rollup merge of #128766 - Monadic-Cat:patch-1, r=tgross35Trevor Gross-1/+1
Trivial grammar fix in const keyword docs This PR makes a trivial fix to the wording of a sentence in the `const` keyword docs. > `const` items looks remarkably similar to `static` items, [...] Either this should be written as > A `const` items looks remarkably similar to a `static` item, [...] or "looks" should be changed to "look". I have selected the smaller diff.
2024-08-06Rollup merge of #128417 - tgross35:f16-f128-math, r=dtolnayTrevor Gross-94/+3506
Add `f16` and `f128` math functions This adds intrinsics and math functions for `f16` and `f128` floating point types. Support is quite limited and some things are broken so tests don't run on many platforms, but this provides a starting point.
2024-08-06Trivial grammar fix in const keyword docsMonadic Cat-1/+1
> `const` items looks remarkably similar to `static` items, [...] Either this should be written as > A `const` items looks remarkably similar to a `static` item, or "looks" should be changed to "look". I have selected the smaller diff.
2024-08-06Update `compiler-builtins` to 0.1.117Trevor Gross-1/+1
This includes [1] which means we can remove the (nonworking) configuration of `no-f16-f128`. Fixes https://github.com/rust-lang/rust/issues/128401. [1]: https://github.com/rust-lang/compiler-builtins/pull/652
2024-08-07Rollup merge of #128751 - devnexen:vxworks_set_thread_name, r=tgross35Matthias Krüger-3/+30
std::thread: set_name implementation proposal for vxWorks.
2024-08-07Rollup merge of #128539 - biabbas:deny_unsafe, r=workingjubileeMatthias Krüger-0/+2
Forbid unused unsafe in vxworks-specific std modules Tracking issue #127747 Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error. Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes. r? ```@workingjubilee```
2024-08-07Rollup merge of #128406 - lolbinarycat:bufreader_peek, r=Mark-SimulacrumMatthias Krüger-0/+55
implement BufReader::peek Part of https://github.com/rust-lang/rust/issues/128405
2024-08-07Rollup merge of #125048 - dingxiangfei2009:stable-deref, r=amanieuMatthias Krüger-0/+5
PinCoerceUnsized trait into core cc ``@Darksonn`` ``@wedsonaf`` ``@ojeda`` This is a PR to introduce a `PinCoerceUnsized` trait in order to make trait impls generated by the proc-macro `#[derive(SmartPointer)]`, proposed by [RFC](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#pincoerceunsized-1), sound. There you may find explanation, justification and discussion about the alternatives. Note that we do not seek stabilization of this `PinCoerceUnsized` trait in the near future. The stabilisation of this trait does not block the eventual stabilization process of the `#[derive(SmartPointer)]` macro. Ideally, use of `DerefPure` is more preferrable except this will actually constitute a breaking change. `PinCoerceUnsized` emerges as a solution to the said soundness hole while avoiding the breaking change. More details on the `DerefPure` option have been described in this [section](https://github.com/rust-lang/rfcs/blob/e17e19ac7ad1c8ccad55d4babfaee1aa107d1da5/text/3621-derive-smart-pointer.md#derefpure) of the RFC linked above. Earlier discussion can be found in this [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Pin.20and.20soundness.20of.20unsizing.20coercions) and [rust-for-linux thread](https://rust-lang.zulipchat.com/#narrow/stream/425075-rust-for-linux/topic/.23.5Bderive.28SmartPointer.29.5D.20and.20pin.20unsoundness.20rfc.233621). try-job: dist-various-2
2024-08-06std::thread: set_name implementation proposal for vxWorks.David Carlier-3/+30
2024-08-06Remove unused lifetime parameter from spawn_uncheckedDavid Tolnay-8/+7
2024-08-05implement BufReader::peekbinarycat-0/+55
2024-08-05WASI fixing unsafe_op_in_unsafe_fn for std::{os, sys}Georgii Rylov-18/+24
2024-08-05Rollup merge of #128026 - devnexen:available_parallelism_vxworks, ↵Matthias Krüger-1/+11
r=Mark-Simulacrum std::thread: available_parallelism implementation for vxWorks proposal.
2024-08-04std: refactor UNIX random data generationjoboet-173/+137
This PR makes a number of changes to the UNIX randomness implementation: * Use `io::Error` for centralized error handling * Move the file-fallback logic out of the `getrandom`-specific module * Stop redefining the syscalls on macOS and DragonFly, they have appeared in `libc` * Add a `OnceLock` to cache the random device file descriptor
2024-08-03Rollup merge of #128551 - Konippi:refactor-backtrace-style-in-panic, r=tgross35Matthias Krüger-19/+10
chore: refactor backtrace style in panic # Refactor get_backtrace_style for better readability and potential performance improvements This PR aims to improve the readability and maintainability of the `set_backtrace_style` and `get_backtrace_style` function.
2024-08-03Auto merge of #128404 - compiler-errors:revert-dead-code-changes, r=pnkfelixbors-0/+4
Revert recent changes to dead code analysis This is a revert to recent changes to dead code analysis, namely: * efdf219 Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov * a70dc297a899b76793a14c5705f6ec78fd7a57a7 Rollup merge of #127017 - mu001999-contrib:dead/enhance, r=pnkfelix * 31fe9628cf830a08e7194a446f66c668aaea86e9 Rollup merge of #127107 - mu001999-contrib:dead/enhance-2, r=pnkfelix * 2724aeaaeb127a8073e39461caacbe21a128ce7b Rollup merge of #126618 - mu001999-contrib:dead/enhance, r=pnkfelix * 977c5fd419ade52467f7de79d5bfc25c0c893275 Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov * 13314df21b0bb0cdd02c6760581d1b9f1052fa7e Rollup merge of #125572 - mu001999-contrib:dead/enhance, r=pnkfelix There is an additional change stacked on top, which suppresses false-negatives that were masked by this work. I believe the functions that are touched in that code are legitimately unused functions and the types are not reachable since this `AnonPipe` type is not publically reachable -- please correct me if I'm wrong cc `@NobodyXu` who added these in ##127153. Some of these reverts (#126315 and #126618) are only included because it makes the revert apply cleanly, and I think these changes were only done to fix follow-ups from the other PRs? I apologize for the size of the PR and the churn that it has on the codebase (and for reverting `@mu001999's` work here), but I'm putting this PR up because I am concerned that we're making ad-hoc changes to fix bugs that are fallout of these PRs, and I'd like to see these changes reimplemented in a way that's more separable from the existing dead code pass. I am happy to review any code to reapply these changes in a more separable way. cc `@mu001999` r? `@pnkfelix` Fixes #128272 Fixes #126169
2024-08-03Suppress new false-negatives that were masked by dead code analysis changesMichael Goulet-0/+4
2024-08-03Rollup merge of #128368 - nnethercote:rustfmt-tweaks, r=cuviperMatthias Krüger-1/+3
Formatting tweaks Some small post-#125443 formatting tweaks. r? ``@cuviper``
2024-08-03Rollup merge of #128303 - NobodyXu:specialise-for-pipe, r=cuviperMatthias Krüger-0/+25
Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}` Enable `std::io::copy` specialisation on unix for the newly added anonymous pipe API, tracking issue rust-lang/rust#127154
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-3/+7
Add `#[must_use]` to some `into_raw*` functions. cc #121287 r? ``@cuviper`` Adds `#[must_use = "losing the pointer will leak memory"]`[^1] to `Box::into_raw(_with_allocator)`, `Vec::into_raw_parts(_with_alloc)`, `String::into_raw_parts`[^2], and `rc::{Rc, Weak}::into_raw_with_allocator` (Rc's normal `into_raw` and all of `Arc`'s `into_raw*`s are already `must_use`). Adds `#[must_use = "losing the raw <resource name may leak resources"]` to `IntoRawFd::into_raw_fd`, `IntoRawSocket::into_raw_socket`, and `IntoRawHandle::into_raw_handle`. [^1]: "*will* leak memory" may be too-strong wording (since `Box`/`Vec`/`String`/`rc::Weak` might not have a backing allocation), but I left it as-is for simplicity and consistency. [^2]: `String::into_raw_parts`'s `must_use` message is changed from the previous (possibly misleading) "`self` will be dropped if the result is not used".
2024-08-03Forbid unsafe_op_in_unsafe_fn in vxworks specific os and sys filesB I Mohammed Abbas-0/+2
2024-08-03chore: refactor backtrace style in panicKonippi-19/+10
2024-08-03Auto merge of #128528 - ↵bors-12/+0
workingjubilee:you-dont-need-to-see-this-cpuid-move-along, r=Amanieu Finish removing `has_cpuid` The one use of it was guaranteed to be always true. try-job: test-various
2024-08-02Rollup merge of #128491 - c410-f3r:unlock-rfc-2011, r=workingjubileeMatthias Krüger-16/+3
[`macro_metavar_expr_concat`] Dogfooding cc #124225 Starts inner usage to test the robustness of the implementation.
2024-08-01std: Remove has_cpuidJubilee Young-12/+0
The one use of it was guaranteed to be always true.
2024-08-01DogfoodCaio-16/+3
2024-08-01Add `core` functions for `f16` and `f128` that require math routinesTrevor Gross-2/+54
`min`, `max`, and similar functions require external math routines. Add these under the same gates as `std` math functions (`reliable_f16_math` and `reliable_f128_math`).
2024-08-01Add math functions for `f16` and `f128`Trevor Gross-92/+3452
This adds missing functions for math operations on the new float types. Platform support is pretty spotty at this point, since even platforms with generally good support can be missing math functions. `std/build.rs` is updated to reflect this.
2024-08-01Rollup merge of #128499 - Konippi:refactor-backtrace-formatting, r=tgross35Matthias Krüger-7/+2
chore: refactor backtrace formatting Replace `write_str()` with the `writeln!()` macro, consolidating multiple write operations.