about summary refs log tree commit diff
path: root/library/std
AgeCommit message (Collapse)AuthorLines
2024-05-03Rollup merge of #124480 - Enselic:on-broken-pipe, r=jieyouxuMichael Goulet-16/+16
Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...` In the stabilization [attempt](https://github.com/rust-lang/rust/pull/120832) of `#[unix_sigpipe = "sig_dfl"]`, a concern was [raised ](https://github.com/rust-lang/rust/pull/120832#issuecomment-2007394609) related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was [also raised](https://github.com/rust-lang/rust/pull/120832#issuecomment-1987023484), namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization. Tracking issue: https://github.com/rust-lang/rust/issues/97889
2024-05-03Rollup merge of #124059 - RalfJung:default_alloc_error_hook, r=workingjubileeMatthias Krüger-0/+6
default_alloc_error_hook: explain difference to default __rdl_oom in alloc Though I'm not sure if that is really the reason that this code is duplicated. On no_std it may already be possible to call user-defined code on allocation failure.
2024-05-03default_alloc_error_hook: explain difference to default __rdl_oom in allocRalf Jung-0/+6
2024-05-03Rollup merge of #124649 - Meziu:master, r=ChrisDentonMatthias Krüger-0/+1
Fix HorizonOS build broken by #124210 HorizonOS (for the Tier-3 target `armv6k-nintendo-3ds`) does not support `dirfd()`, as many other similar targets.
2024-05-03Horizon OS: dirfd unavailableAndrea Ciliberti-0/+1
2024-05-03Rollup merge of #124609 - RalfJung:float-precision, r=cuviperMatthias Krüger-116/+174
variable-precision float operations can differ depending on optimization levels Follow-up to https://github.com/rust-lang/rust/pull/121793 and https://github.com/rust-lang/rust/pull/118217 that accounts for optimizations changing the precision of these functions. Fixes https://github.com/rust-lang/rust/issues/109118 Fixes https://github.com/rust-lang/rust/issues/71355
2024-05-03Rollup merge of #124604 - Enselic:std-gimli-symbolize, r=workingjubileeMatthias Krüger-2/+0
library/std: Remove unused `gimli-symbolize` feature library/backtrace also declares a feature called `gimli-symbolize` which appear used, but the feature in std with the same name is unused, so remove it.
2024-05-03Rollup merge of #124412 - RalfJung:io-safety, r=AmanieuMatthias Krüger-11/+22
io safety: update Unix explanation to use `Arc` Fixes https://github.com/rust-lang/rust/issues/124384 Cc ```@jsgf```
2024-05-02Change `SIGPIPE` ui from `#[unix_sigpipe = "..."]` to `-Zon-broken-pipe=...`Martin Nordholts-16/+16
In the stabilization attempt of `#[unix_sigpipe = "sig_dfl"]`, a concern was raised related to using a language attribute for the feature: Long term, we want `fn lang_start()` to be definable by any crate, not just libstd. Having a special language attribute in that case becomes awkward. So as a first step towards towards the next stabilization attempt, this PR changes the `#[unix_sigpipe = "..."]` attribute to a compiler flag `-Zon-broken-pipe=...` to remove that concern, since now the language is not "contaminated" by this feature. Another point was also raised, namely that the ui should not leak **how** it does things, but rather what the **end effect** is. The new flag uses the proposed naming. This is of course something that can be iterated on further before stabilization.
2024-05-02variable-precision float operations behave non-deterministicallyRalf Jung-116/+174
2024-05-02std: move thread parking to `sys::sync`joboet-57/+25
2024-05-02library/std: Remove unused `gimli-symbolize` featureMartin Nordholts-2/+0
library/backtrace also declares a feature called `gimli-symbolize` which appear used, but the feature in std with the same name is unused, so remove it.
2024-05-01Step bootstrap cfgsMark Rousskov-3/+1
2024-05-01Replace version placeholders for 1.79Mark Rousskov-9/+9
2024-05-01Auto merge of #124491 - madsmtm:target_vendor-apple, r=workingjubileebors-354/+81
Use `target_vendor = "apple"` instead of `target_os = "..."` Use `target_vendor = "apple"` instead of `all(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos")`. The apple targets are quite close to being identical, with iOS, tvOS, watchOS and visionOS being even closer, so using `target_vendor` when possible makes it clearer when something is actually OS-specific, or just Apple-specific. Note that `target_vendor` will [be deprecated in the future](https://github.com/rust-lang/rust/issues/100343), but not before an alternative (like `target_family = "apple"`) is available. While doing this, I found various inconsistencies and small mistakes in the standard library, see the commits for details. Will follow-up with an extra PR for a similar issue that need a bit more discussion. EDIT: https://github.com/rust-lang/rust/pull/124494 Since you've talked about using `target_vendor = "apple"` in the past: r? workingjubilee CC `@simlay,` `@thomcc` `@rustbot` label O-macos O-ios O-tvos O-watchos O-visionos
2024-04-30std: rewrite TLS on platforms without threadsjoboet-71/+77
2024-04-29Document that `create_dir_all` calls `mkdir`/`CreateDirW` multiple timesTobias Bucher-3/+7
Also mention that there might be leftover directories in the error case.
2024-04-29Fix Fuchsia build broken by #124210David Koloski-0/+1
Fuchsia doesn't support dirfd although we have a symbol stubbed for it.
2024-04-29Fix ESP IDF build broken by #124210ivmarkov-0/+1
2024-04-28Run tidy on testsRyan Lowe-27/+45
2024-04-28Fix posix_spawn not being used on iOS and visionOSMads Marquart-8/+3
`man posix_spawn` documents it to be able to return `ENOENT`, and there should be nothing preventing this. Tested in the iOS simulator and on Mac Catalyst.
2024-04-28Move various stdlib tests to library/std/testsRyan Lowe-0/+312
2024-04-28Fix SIGEMT and SIGINFO parsing on watchOS and visionOSMads Marquart-7/+3
2024-04-28Fix available_parallelism on watchOS and visionOSMads Marquart-3/+1
Both `sysconf` and `_SC_NPROCESSORS_ONLN` is available on all Apple platforms.
2024-04-28std::net: Socket::new_raw set to SO_NOSIGPIPE on freebsd/netbsd/dragonfly.David Carlier-1/+8
2024-04-28Use `target_vendor = "apple"` instead of `target_os = "..."`Mads Marquart-336/+74
2024-04-28Auto merge of #124210 - the8472:consign-ebadf-to-the-fire, r=Mark-Simulacrumbors-1/+39
Abort a process when FD ownership is violated When an owned FD has already been closed before it's dropped that means something else touched an FD in ways it is not allowed to. At that point things can already be arbitrarily bad, e.g. clobbered mmaps. Recovery is not possible. All we can do is hasten the fire. Unlike the previous attempt in #124130 this shouldn't suffer from the possibility that FUSE filesystems can return arbitrary errors.
2024-04-28put FD validity behind late debug_asserts checkingThe 8472-29/+32
uses the same machinery as assert_unsafe_precondition
2024-04-28Rollup merge of #124447 - workingjubilee:set-argv-twice-on-gnu, r=ChrisDentonMatthias Krüger-6/+4
Unconditionally call `really_init` on GNU/Linux This makes miri not diverge in behavior, it fixes running Rust linux-gnu binaries on musl with gcompat, it fixes dlopen edge-cases that cranelift somehow hits, etc. Fixes #124126 thou hast gazed into this abyss with me: r? ``@ChrisDenton``
2024-04-27Unconditionally call really_initJubilee Young-6/+4
This makes miri not diverge in behavior, it fixes running Rust linux-gnu binaries on musl with gcompat, it fixes dlopen edge-cases that cranelift somehow hits, etc.
2024-04-27Lift the probe code of `copy_file_range` into a functionTobias Bucher-29/+31
2024-04-27Elaborate in comment about `statx` probeTobias Bucher-8/+4
As requested by @workingjubilee in https://github.com/rust-lang/rust/pull/123928#discussion_r1564916743.
2024-04-27io safety: update Unix explanationRalf Jung-11/+22
2024-04-27Rollup merge of #124387 - workingjubilee:use-raw-pointers-in-thread-locals, ↵Matthias Krüger-9/+12
r=joboet thread_local: be excruciatingly explicit in dtor code Use raw pointers to accomplish internal mutability, and clearly split references where applicable. This reduces the likelihood that any of these parts are misunderstood, either by humans or the compiler's optimizations. Fixes #124317 r? ``@joboet``
2024-04-26thread_local: refine LazyKeyInner::take safety docJubilee-1/+1
Co-authored-by: joboet <jonasboettiger@icloud.com>
2024-04-26Rollup merge of #124410 - RalfJung:path-buf-transmute, r=NilstriebJacob Pratt-7/+25
PathBuf: replace transmuting by accessor functions The existing `repr(transparent)` was anyway insufficient as `OsString` was not `repr(transparent)`. And furthermore, on Windows it was blatantly wrong as `OsString` wraps `Wtf8Buf` which is a `repr(Rust)` type with 2 fields: https://github.com/rust-lang/rust/blob/51a7396ad3d78d9326ee1537b9ff29ab3919556f/library/std/src/sys_common/wtf8.rs#L131-L146 So let's just be honest about what happens and add accessor methods that make this abstraction-breaking act of PathBuf visible on the APIs that it pierces through. Fixes https://github.com/rust-lang/rust/issues/124409
2024-04-26Auto merge of #123909 - dtolnay:utf8chunks, r=joboetbors-5/+2
Stabilize `Utf8Chunks` Pending FCP in https://github.com/rust-lang/rust/issues/99543. This PR includes the proposed modification in https://github.com/rust-lang/libs-team/issues/190 as agreed in https://github.com/rust-lang/rust/issues/99543#issuecomment-2050406568.
2024-04-26PathBuf: replace transmuting by accessor functionsRalf Jung-7/+25
2024-04-25Rollup merge of #124076 - NobodyXu:patch-1, r=dtolnayMichael Goulet-3/+1
Stablise io_error_downcast Tracking issue #99262 Closes #99262 FCP completed in https://github.com/rust-lang/rust/issues/99262#issuecomment-2077374397
2024-04-25thread_local: split refs to fields of KeyJubilee Young-3/+4
2024-04-25thread_local: use less &mut T in LazyKeyInner::takeJubilee Young-6/+8
Instead, use raw pointers to accomplish internal mutability throughout.
2024-04-24Stabilize Utf8ChunksDavid Tolnay-5/+2
2024-04-25Rollup merge of #124335 - ChrisDenton:stabilize-absolute, r=dtolnayMatthias Krüger-3/+1
Stabilize `std::path::absolute` FCP complete in https://github.com/rust-lang/rust/issues/92750#issuecomment-2075046985
2024-04-24Stabilize `std::path::absolute`Chris Denton-3/+1
2024-04-24Rollup merge of #124282 - RalfJung:fill_utf16_buf, r=ChrisDentonLeón Orell Valerian Liehr-5/+14
windows fill_utf16_buf: explain the expected return value The comment just says "return what the syscall returns", but that doesn't work for all syscalls as the Windows API is not consistent in how buffer size is negotiated. For instance, GetUserProfileDirectoryW works a bit differently, and so home_dir_crt has to translate this to the usual protocol itself. So it's worth describing that protocol. r? ``@ChrisDenton``
2024-04-24Rollup merge of #124281 - RalfJung:win-tls, r=joboetLeón Orell Valerian Liehr-4/+22
fix weak memory bug in TLS on Windows We need to store the `key` *after* we register the dtor. Now I hope there isn't also some other reason why we have to actually register the dtor last... `@joboet` is there a reason you picked this particular order in https://github.com/rust-lang/rust/pull/102655? Fixes https://github.com/rust-lang/rust/issues/123583
2024-04-23increase the readability by using the unique name for the hermit-abiStefan Lankes-80/+81
Take up suggestion from the discussions within rust-lang/rust#115984 to increase readability.
2024-04-23revise the interpretation of ReadDirStefan Lankes-12/+8
HermitOS supports getdents64. As under Linux, the dirent64 entry `d_off` is not longer used, because its definition is not clear. Instead of `d_off` the entry `d_reclen` is used to determine the end of the dirent64 entry.
2024-04-23fix weak memory bug in TLS on WindowsRalf Jung-4/+22
2024-04-23windows fill_utf16_buf: explain the expected return valueRalf Jung-5/+14