about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2024-07-16std: unwrapped unsafe is VERBOTEN!Jubilee-1/+1
Co-authored-by: Jonas Böttiger <jonasboettiger@icloud.com>
2024-07-16Use futex.rs for Windows thread parkingChris Denton-26/+39
2024-07-16std: Use read_unaligned for reading DWARFJubilee Young-14/+12
2024-07-16deny unsafe_op_in_unsafe_fn for teeos袁浩----天命剑主-0/+1
2024-07-16clean unsafe op in unsafe fn袁浩----天命剑主-13/+15
2024-07-16clean unsafe op in unsafe fn袁浩----天命剑主-4/+4
2024-07-16clean unsafe op in unsafe fn袁浩----天命剑主-9/+9
2024-07-16delete #![allow(unsafe_op_in_unsafe_fn)]袁浩----天命剑主-1/+0
this is redundant, so we can just delete it.
2024-07-15lib: replace some `mem::forget`'s with `ManuallyDrop`Pavel Grigorenko-65/+36
2024-07-15Auto merge of #127020 - tgross35:f16-f128-classify, r=workingjubileebors-38/+94
Add classify and related methods for f16 and f128 Also constify some functions where that was blocked on classify being available. r? libs
2024-07-15allow(unsafe_op_in_unsafe_fn) on some functionsChris Denton-3/+6
These need to get their safety story straight
2024-07-15Some Windows functions are safeChris Denton-23/+25
2024-07-15Deny more windows unsafe_op_in_unsafe_fnChris Denton-47/+63
2024-07-15Windows: move BSD socket shims to netcChris Denton-109/+109
2024-07-15Rollup merge of #127750 - ChrisDenton:safe-unsafe-unsafe, r=workingjubileeJubilee-25/+51
Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of #127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
2024-07-15Rollup merge of #127744 - workingjubilee:deny-unsafe-op-in-std, r=jhprattJubilee-66/+89
std: `#![deny(unsafe_op_in_unsafe_fn)]` in platform-independent code This applies the `unsafe_op_in_unsafe_fn` lint in all places in std that _do not have platform-specific cfg in their code_. For all such places, the lint remains allowed, because they need further work to address the relevant concerns. This list includes: - `std::backtrace_rs` (internal-only) - `std::sys` (internal-only) - `std::os` Notably this eliminates all "unwrapped" unsafe operations in `std::io` and `std::sync`, which will make them much more auditable in the future. Such has *also* been left for future work. While I made a few safety comments along the way on interfaces I have grown sufficiently familiar with, in most cases I had no context, nor particular confidence the unsafety was correct. In the cases where I was able to determine the unsafety was correct without having prior context, it was obviously redundant. For example, an unsafe function calling another unsafe function that has the exact same contract, forwarding its caller's requirements just as it forwards its actual call.
2024-07-15Rollup merge of #127712 - ChrisDenton:raw-types, r=workingjubileeJubilee-200/+166
Windows: Remove some unnecessary type aliases Back in the olden days, C did not have fixed-width types so these type aliases were at least potentially useful. Nowadays, and especially in Rust, we don't need the aliases and they don't help with anything. Notably the windows bindings we use also don't bother with the aliases. And even when we have used aliases they're often only used once then forgotten about. The only one that gives me pause is `DWORD` because it's used a fair bit. But it's still used inconsistently and we implicitly assume it's a `u32` anyway (e.g. `as` casting from an `i32`).
2024-07-15Move safety comment outside unsafe blockChris Denton-1/+1
2024-07-15Make os/windows default to deny unsafe in unsafeChris Denton-15/+26
2024-07-15Make pal/windows default to deny unsafe in unsafeChris Denton-11/+26
2024-07-15Fix Windows 7Chris Denton-4/+4
2024-07-15Auto merge of #127719 - devnexen:math_log_fix_solill, r=Amanieubors-34/+3
std: removes logarithms family function edge cases handling for solaris. Issue had been fixed over time with solaris, 11.x behaves correctly (and we support it as minimum), illumos works correctly too.
2024-07-15Don't re-export `c_int` from `c`Chris Denton-8/+7
2024-07-15Remove DWORDChris Denton-105/+90
2024-07-15Remove ULONGChris Denton-14/+13
2024-07-15Remove PSRWLOCKChris Denton-4/+1
2024-07-15Remove LPVOIDChris Denton-18/+18
2024-07-15Remove LPSECURITY_ATTRIBUTESChris Denton-3/+2
2024-07-15Remove LPOVERLAPPEDChris Denton-2/+1
2024-07-15Remove LPCVOIDChris Denton-2/+1
2024-07-15Remove SIZE_TChris Denton-3/+2
2024-07-15Remove CHARChris Denton-4/+3
As with USHORT, keep using C types for BSD socket APIs.
2024-07-15Remove USHORTChris Denton-4/+3
We stick to C types in for socket and address as these are at least nominally BSD-ish and they're used outside of pal/windows in general *nix code
2024-07-15Remove LPWSTRChris Denton-10/+8
2024-07-15Remove UINTChris Denton-2/+1
2024-07-15Remove LONGChris Denton-4/+2
2024-07-15Remove LARGE_INTEGERChris Denton-16/+15
2024-07-15Remove NonZeroDWORDChris Denton-5/+3
2024-07-15Auto merge of #127732 - GrigorenkoPV:teeos-safe-sys-init, r=Amanieubors-5/+6
sys::init is not unsafe on teeos https://github.com/rust-lang/rust/blob/88fa119c77682e6d55ce21001cf761675cfebeae/library/std/src/sys/pal/teeos/mod.rs#L40-L42 r​? `@petrochenkov`
2024-07-14std: Unsafe-wrap std::syncJubilee Young-41/+54
2024-07-14std: Unsafe-wrap in Wtf8 implJubilee Young-5/+10
2024-07-14std: Unsafe-wrap std::ioJubilee Young-9/+13
2024-07-14std: Directly call unsafe {un,}setenv in envJubilee Young-11/+4
2024-07-14std: Unsafe-wrap OSStr{,ing}::from_encoded_bytes_uncheckedJubilee Young-3/+2
2024-07-14std: Unsafe-wrap HashMap::get_many_unchecked_mutJubilee Young-3/+1
2024-07-14std: deny(unsafe_op_in_unsafe_fn) but allow sitesJubilee Young-1/+12
This provides a list of locations to hunt down issues in.
2024-07-14Add `classify` and related methods for `f16` and `f128`Trevor Gross-38/+94
2024-07-14std: removes logarithms family function edge cases handling for solaris.David Carlier-34/+3
Issue had been fixed over time with solaris, 11.x behaves correctly (and we support it as minimum), illumos works correctly too.
2024-07-14sys::init is not unsafe on teeosPavel Grigorenko-5/+6
2024-07-14Auto merge of #125935 - madsmtm:merge-os-apple, r=workingjubileebors-797/+86
Merge Apple `std::os` extensions modules into `std::os::darwin` The functionality available on Apple platforms are very similar, and were (basically) duplicated for each platform. This PR rectifies that by merging the code into one module. Ultimately, I've done this to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings. Publically exposing these to tvOS/watchOS/visionOS targets is considered in https://github.com/rust-lang/rust/pull/123723, but that seems to be dragging out, and in any case I think it makes sense to do the refactor separately from stabilization. r? libs Fixes https://github.com/rust-lang/rust/issues/121640 and https://github.com/rust-lang/rust/issues/124825.