about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
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-08Vxworks: Extern taskNameSet and fix build errorsB I Mohammed Abbas-20/+8
2024-08-08Fix VxWorks available parallelism: Move nonzero::uncheked into unsafe blockB I Mohammed Abbas-3/+5
2024-08-06Rollup merge of #128417 - tgross35:f16-f128-math, r=dtolnayTrevor Gross-0/+15
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-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/+1
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 #125048 - dingxiangfei2009:stable-deref, r=amanieuMatthias Krüger-0/+4
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-05WASI fixing unsafe_op_in_unsafe_fn for std::{os, sys}Georgii Rylov-16/+22
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-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-0/+2
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/+3
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/+1
2024-08-03Auto merge of #128528 - ↵bors-8/+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/+2
[`macro_metavar_expr_concat`] Dogfooding cc #124225 Starts inner usage to test the robustness of the implementation.
2024-08-01std: Remove has_cpuidJubilee Young-8/+0
The one use of it was guaranteed to be always true.
2024-08-01DogfoodCaio-16/+2
2024-08-01Add math functions for `f16` and `f128`Trevor Gross-0/+15
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 #128433 - hermit-os:hermit-unsafe_op_in_unsafe_fn, r=joboetMatthias Krüger-55/+57
fix(hermit): `deny(unsafe_op_in_unsafe_fn)` Tracking issue: https://github.com/rust-lang/rust/issues/127747 r? workingjubilee CC: ``@stlankes``
2024-08-01fix(pal/hermit): `deny(unsafe_op_in_unsafe_fn)`Martin Kröning-20/+40
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-08-01refactor(pal/hermit): make `ENV` a non-mutable staticMartin Kröning-19/+15
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-08-01Rollup merge of #128416 - maurer:remove-android-hack, r=tgross35Matthias Krüger-104/+0
android: Remove libstd hacks for unsupported Android APIs Our minimum supported API version is 21, remove hacks to support older Android APIs. try-job: arm-android r? tgross35
2024-08-01Rollup merge of #128162 - ChrisDenton:cleanup, r=joboetMatthias Krüger-59/+27
Cleanup sys module to match house style This moves a test file out of sys as it's just testing std types. Also cleans up some assorted bits including making the `use` statements match the house style.
2024-07-31std: fix busy-waiting in `Once::wait_force`, add more testsjoboet-4/+8
2024-07-31std: implement the `once_wait` featurejoboet-94/+178
2024-07-31Remove unneeded `pub(crate)`Chris Denton-1/+1
2024-07-31refactor(pal/hermit): use default impl of `GlobalAlloc::alloc_zeroed`Martin Kröning-10/+0
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-07-31refactor(pal/hermit): return `!` to satisfy rust-analyzerMartin Kröning-7/+3
This silences this rust-analyzer-specific error: `expected !, found ()` Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2024-07-31PinCoerceUnsized trait into coreXiangfei Ding-0/+4
2024-07-31android: Remove libstd hacks for unsupported Android APIsMatthew Maurer-104/+0
Our minimum supported API version is 21, remove hacks to support older Android APIs.
2024-07-30Move Windows implementation of anon pipeChris Denton-21/+12
2024-07-30Cleanup sys module to match house styleChris Denton-37/+14
2024-07-30Rollup merge of #128315 - zetanumbers:psvita-unsafe-in-unsafe, r=workingjubileeMatthias Krüger-0/+4
Fix vita build of std and forbid unsafe in unsafe in the os/vita module See #127747 r? `@workingjubilee` `@pheki` `@nikarh`
2024-07-30Insert some blank lines.Nicholas Nethercote-0/+2
After things that are immediately followed by a `use` declaration and look like they might apply to that `use` item but actually don't.
2024-07-29Sparkle some attributes over `CloneToUninit` stuffPavel Grigorenko-0/+2
2024-07-29impl CloneToUninit for Path and OsStrPavel Grigorenko-0/+24
2024-07-29Rollup merge of #128055 - ↵Matthias Krüger-53/+61
workingjubilee:deny-unsafe-ops-in-sys-personality-dwarf-eh, r=Amanieu std: unsafe-wrap personality::dwarf::eh Moves the forbiddance up a little. This is another largely whitespace diff, except for hoisting some variable declarations to allow enclosing the `unsafe {}` scope fully and make it clearer where the bounds of some temporaries are.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-629/+441
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-28fix: psvita's std codeDaria Sukhonina-0/+4
2024-07-28Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`Jiahao XU-0/+25
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-26Fix doc nitsJohn Arundel-50/+54
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-25fix: compilation issue w/ refactored typeJulius Liu-2/+2
2024-07-25Auto merge of #128195 - matthiaskrgr:rollup-195dfdf, r=matthiaskrgrbors-41/+26
Rollup of 6 pull requests Successful merges: - #126908 (Use Cow<'static, str> for InlineAsmTemplatePiece::String) - #127999 (Inject arm32 shims into Windows metadata generation) - #128137 (CStr: derive PartialEq, Eq; add test for Ord) - #128185 (Fix a span error when parsing a wrong param of function.) - #128187 (Fix 1.80.0 version in RELEASES.md) - #128189 (Turn an unreachable code path into an ICE) r? `@ghost` `@rustbot` modify labels: rollup
2024-07-25Rollup merge of #127999 - ChrisDenton:arm32, r=AmanieuMatthias Krüger-41/+26
Inject arm32 shims into Windows metadata generation I had been keen to eventually move to using windows-sys as a normal Cargo dependency. But for linking, compile times and other reasons that's unlikely to ever happen. So if we're sticking with generated bindings then injecting any necessary missing type definitions (i.e. for the MS unsupported arm32) is simpler than defining whole functions ourselves just because we need to manually implement those types on a tier 3 platform. This also reduces the places we need to change when making changes to how we use `#[link]`. r? libs
2024-07-25Rollup merge of #128158 - workingjubilee:unsafe-wrap-personality-gcc, ↵Matthias Krüger-141/+180
r=ChrisDenton std: unsafe-wrap personality::gcc Nothing seems obviously wrong with these implementations except for some unanswered questions. Admittedly, I don't want to burn excessive time on exceptional exception handlers. Thus this is mostly a brute-force syntactic wrapping and some comments where they seemed correct, creating another largely whitespace diff. try-job: armhf-gnu