rust/library/std/src
Matthias Krüger 6ab180577f
Rollup merge of #129581 - RalfJung:exit, r=joshtriplett
exit: explain our expectations for the exit handlers registered in a Rust program

This documents the position of ``@Amanieu`` and others in https://github.com/rust-lang/rust/issues/126600: a library with an atexit handler that destroys state that other threads could still be working on is buggy. We do not consider it acceptable for a library to say "you must call the following cleanup function before exiting from `main` or calling `exit`". I don't know if this is established ``@rust-lang/libs-api``  consensus so I presume this will have to go through FCP.

Given that Rust supports concurrency, I don't think there is any way to write a sound Rust wrapper around a library that has such a required cleanup function: even if we made `exit` unsafe, and the Rust wrapper used the scope-with-callback approach to ensure it can run cleanup code before returning from the wrapper (like `thread::scope`), one could still call this wrapper in a second thread and then return from `main` while the wrapper runs. Making this sound would require `std` to provide a way to "block" returning from `main`, so that while the wrapper runs returning from `main` waits until the wrapper is done... that just doesn't seem feasible.

The `exit` docs do not seem like the best place to document this, but I also couldn't think of a better one.
2024-08-27 18:59:27 +02:00
..
backtrace remove redundant imports 2023-12-10 10:56:22 +08:00
collections Reformat use declarations. 2024-07-29 08:26:52 +10:00
env remove redundant imports 2023-12-10 10:56:22 +08:00
error Reformat use declarations. 2024-07-29 08:26:52 +10:00
f16 std float tests: special-case Miri in feature detection 2024-08-08 12:17:50 +02:00
f32 Reformat use declarations. 2024-07-29 08:26:52 +10:00
f64 Reformat use declarations. 2024-07-29 08:26:52 +10:00
f128 Add core functions for f16 and f128 that require math routines 2024-08-01 15:38:53 -04:00
ffi Sparkle some attributes over CloneToUninit stuff 2024-07-29 20:44:42 +03:00
fs Reformat use declarations. 2024-07-29 08:26:52 +10:00
hash Reformat use declarations. 2024-07-29 08:26:52 +10:00
io Rollup merge of #128406 - lolbinarycat:bufreader_peek, r=Mark-Simulacrum 2024-08-07 00:34:12 +02:00
net Reformat use declarations. 2024-07-29 08:26:52 +10:00
num removed nonfunctioning benchmark 2024-01-11 11:30:12 -05:00
os Rollup merge of #128432 - g0djan:godjan/wasi_prohibit_implicit_unsafe, r=tgross35 2024-08-22 08:17:19 +02:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path impl CloneToUninit for Path and OsStr 2024-07-29 20:44:39 +03:00
pipe Cleanup sys module to match house style 2024-07-30 19:22:54 +00:00
prelude Avoid comments that describe multiple use items. 2024-07-17 08:02:46 +10:00
process Reformat use declarations. 2024-07-29 08:26:52 +10:00
sync rwlock: disable 'frob' test in Miri on macOS 2024-08-08 11:15:18 +02:00
sys Auto merge of #128134 - joboet:move_pal_alloc, r=cupiver 2024-08-27 13:51:39 +00:00
sys_common Rollup merge of #127623 - lolbinarycat:fix_remove_dir_all, r=Amanieu 2024-08-23 06:26:51 +02:00
thread Stabilize std:🧵:Builder::spawn_unchecked 2024-08-16 10:43:47 -07:00
time Reformat use declarations. 2024-07-29 08:26:52 +10:00
alloc.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
ascii.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
backtrace.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
env.rs Rollup merge of #128902 - evanj:evan.jones/env-var-doc, r=workingjubilee 2024-08-18 23:41:47 -05:00
error.rs chore: refactor backtrace formatting 2024-08-02 00:24:29 +09:00
f16.rs also update copysign docs 2024-08-26 17:25:24 +02:00
f32.rs also update copysign docs 2024-08-26 17:25:24 +02:00
f64.rs also update copysign docs 2024-08-26 17:25:24 +02:00
f128.rs also update copysign docs 2024-08-26 17:25:24 +02:00
fs.rs fix: fs::remove_dir_all: treat ENOENT as success 2024-08-22 14:18:42 -04:00
keyword_docs.rs Trivial grammar fix in const keyword docs 2024-08-06 21:59:04 -05:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs library: Move unstable API of new_uninit to new features 2024-08-23 20:52:02 -07:00
macros.rs Add math functions for f16 and f128 2024-08-01 15:38:51 -04:00
num.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
panic.rs std: do not overwrite style in get_backtrace_style 2024-08-12 10:08:56 +02:00
panicking.rs panicking: improve hint for Miri's RUST_BACKTRACE behavior 2024-08-24 14:38:50 +02:00
pat.rs Add pattern types to parser 2024-04-08 11:57:17 +00:00
path.rs Sparkle some attributes over CloneToUninit stuff 2024-07-29 20:44:42 +03:00
pipe.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
process.rs exit: explain our expectations for the exit handlers registered in a Rust program 2024-08-25 17:46:26 +02:00
rt.rs Use #[rustfmt::skip] on some use groups to prevent reordering. 2024-07-19 13:26:48 +10:00
time.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00