summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-10-29Only test pthread_getname_np on linux-gnuJosh Stone-1/+7
2022-10-29Move truncation next to other thread tests for tidyJosh Stone-25/+25
2022-10-29Truncate thread names on Linux and Apple targetsJosh Stone-0/+43
These targets have system limits on the thread names, 16 and 64 bytes respectively, and `pthread_setname_np` returns an error if the name is longer. However, we're not in a context that can propagate errors when we call this, and we used to implicitly truncate on Linux with `prctl`, so now we manually truncate these names ahead of time.
2022-10-29Mark `std::os::wasi::io::AsFd` etc. as stable.Dan Gohman-20/+7
io_safety was stabilized in Rust 1.63, so mark the io_safety exports in `std::os::wasi::io` as stable. Fixes #103306.
2022-10-20Avoid defensive re-initialization of the BufReader bufferBen Kimock-3/+48
(cherry picked from commit 95ae993bd86b97aff9a27498f2187fef431cab58)
2022-10-06Revert "Use getentropy when possible on all Apple platforms"BlackHoleFox-56/+38
This reverts commit 3fc35b5b935e390c61ea2bbf744838b2632b2df1. (cherry picked from commit a955ef2c8c95a289f0753e533b690c576b1806bf)
2022-09-19replace stabilization placeholdersPietro Albini-14/+14
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15Rollup merge of #101559 - andrewpollack:add-backtrace-off-fuchsia, r=tmandryMatthias Krüger-17/+16
Adding "backtrace off" option for fuchsia targets Used for improving compiler test suite results on Fuchsia targets
2022-09-14Adding backtrace off option for fuchsia targetsAndrew Pollack-17/+16
2022-09-12Simplify `clippy` fix.Markus Reiter-2/+0
2022-09-12Add `rustc_diagnostic_item` for IP addresses.Markus Reiter-0/+5
2022-09-12Flatten `net` module again.Markus Reiter-9/+7
2022-09-12Move `net::parser` into `net::addr` module.Markus Reiter-3/+3
2022-09-12Add tests for `SockAddr` `Display`.Markus Reiter-0/+69
2022-09-12Use `DisplayBuffer` for socket addresses.Markus Reiter-46/+34
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-14/+2
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-09-11Auto merge of #101442 - joboet:null_check_tcs, r=thomccbors-2/+6
Check if TCS is a null pointer on SGX The `EENTER` instruction only checks if the TCS is aligned, not if it zero. Saying the address returned is a `NonNull<u8>` (for which `Tcs` is a type alias) is unsound. As well-behaved runners will not put the TCS at address zero, so the definition of `Tcs` is correct. However, `std` should check the address before casting it to a `NonNull`. ping `@jethrogb` `@raoulstrackx` `@rustbot` label I-unsound
2022-09-11std: check if TCS is a null pointerjoboet-2/+6
2022-09-11Auto merge of #101482 - joboet:netbsd_parker, r=sanxiynbors-12/+136
Optimize thread parking on NetBSD As the futex syscall is not present in the latest stable release, NetBSD cannot use the efficient thread parker and locks Linux uses. Currently, it therefore relies on a pthread-based parker, consisting of a mutex and semaphore which protect a state variable. NetBSD however has more efficient syscalls available: [`_lwp_park`](https://man.netbsd.org/_lwp_park.2) and [`_lwp_unpark`](https://man.netbsd.org/_lwp_unpark.2). These already provide the exact semantics of `thread::park` and `Thread::unpark`, but work with thread ids. In `std`, this ID is here stored in an atomic state variable, which is also used to optimize cases were the parking token is already available at the time `thread::park` is called. r? `@m-ou-se`
2022-09-11Auto merge of #101643 - ChrisDenton:alloc-link-kernel32, r=thomccbors-0/+1
Explicitly link kernel32.lib from alloc
2022-09-10std: optimize thread parking on NetBSDjoboet-12/+136
2022-09-10Rollup merge of #101606 - akhi3030:patch-1, r=Dylan-DPCDylan DPC-1/+1
doc: fix minor typo
2022-09-10Explicitly link kernel32.lib from allocChris Denton-0/+1
2022-09-09Auto merge of #101617 - Dylan-DPC:rollup-iiy4ipc, r=Dylan-DPCbors-18/+20
Rollup of 5 pull requests Successful merges: - #101366 (Restore old behaviour on broken UNC paths) - #101492 (Suggest adding array lengths to references to arrays if possible) - #101529 (Fix the example code and doctest for Formatter::sign_plus) - #101573 (update `ParamKindOrd`) - #101612 (Fix code generation of `Rvalue::Repeat` with 128 bit values) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-09Rollup merge of #101366 - ChrisDenton:unc-forward-slash, r=m-ou-seDylan DPC-18/+20
Restore old behaviour on broken UNC paths This fixes #101358 by restoring the behaviour from previous stable Rust versions. I'm not convinced this is ultimately right but I think it's less wrong and maybe this should be backported to beta? r? libs
2022-09-09std: use futex-based locks and thread parker on Hermitjoboet-452/+48
2022-09-09doc: fix minor typoAkhilesh Singhania-1/+1
2022-09-08Rollup merge of #101423 - mkroening:hermit-warnings, r=sanxiynMichael Goulet-4/+0
Fix hermit warnings This fixes two `unused_imprt` and one `dead_code` warning for hermit.
2022-09-08Rollup merge of #101422 - mkroening:hermit-file-time, r=joshtriplettDylan DPC-0/+12
Hermit: Add File::set_time stub This is not supported on hermit yet. This change is required for compiling std.
2022-09-07Auto merge of #101544 - matthiaskrgr:rollup-4urx917, r=matthiaskrgrbors-0/+15
Rollup of 14 pull requests Successful merges: - #101343 (Add -api-level to pm command) - #101416 (stdio: Document no support for writing to non-blocking stdio/stderr) - #101435 (Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH`) - #101493 (Pass ImplTraitContext as &mut to avoid the need of ImplTraitContext::reborrow) - #101502 (Do not suggest a semicolon for a macro without `!`) - #101503 (Add debug calls) - #101506 (rustdoc: remove unused CSS `#main-content > .since`) - #101507 (rustdoc: remove unused CSS `#main-content > table td`) - #101521 (Rustdoc-Json: More accurate struct type.) - #101525 (Fix typo in pass_manager.rs) - #101534 (rustdoc: remove unused mobile CSS `.rustdoc { flex-direction }`) - #101535 (Fix error printing mistake in tidy) - #101536 (Add documentation for Attr::is_doc_comment) - #101538 (rustdoc: remove unused CSS `.content .methods > div`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-07Auto merge of #101476 - ChrisDenton:BCryptRandom-fix, r=thomccbors-20/+88
Open a BCrypt algorithm handle Fixes #101474, supplants #101456. Replaces use of a pseduo handle with manually opening a algorithm handle. Most interesting thing here is the atomics. r? `@thomcc`
2022-09-07stdio: Document no support for writing to non-blocking stdio/stderrUsama Arif-0/+15
Printing to stdio/stderr that have been opened with non-blocking (O_NONBLOCK in linux) can result in an error, which is not handled by std::io module causing a panic. Signed-off-by: Usama Arif <usama.arif@bytedance.com>
2022-09-07Don't break windows/rand for miriChris Denton-0/+12
2022-09-06Open a BCrypt algorithm handleChris Denton-20/+76
2022-09-06Fix compile errors for uwp-windows-msvc targetsChris Denton-1/+1
2022-09-06Rollup merge of #101426 - beetrees:dup-no-stdio, r=thomccYuki Okushi-1/+2
Don't duplicate file descriptors into stdio fds Ensures that file descriptors are never duplicated into the stdio fds even if a stdio fd has been closed.
2022-09-06Rollup merge of #101404 - joboet:always_cleanup_stdout, r=joshtriplettYuki Okushi-8/+17
Fix cleanup for uninitialized stdout Fixes #101375 by disabling buffering even if the buffer was not initialized yet.
2022-09-05Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obkDylan DPC-1/+1
more clippy::perf fixes
2022-09-05std: fix cleanup for uninitialized stdout (#101375)joboet-8/+17
2022-09-04Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrumbors-165/+39
Make `ReentrantMutex` movable and `const` As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-05Hermit: Remove unused socklen_t (dead_code)Martin Kröning-2/+0
2022-09-05Hermit: Fix unused_importsMartin Kröning-2/+0
2022-09-05Hermit: Add File::set_time stubMartin Kröning-0/+12
This is not supported on hermit yet. This change is required for compiling std.
2022-09-04Rollup merge of #101394 - CAD97:patch-3, r=Mark-SimulacrumMatthias Krüger-1/+4
Forbid mixing `System` with direct sytem allocator calls e.g. [on windows](https://github.com/rust-lang/rust/blob/dec689432fac6720b2f18101ac28a21add98b1b8/library/std/src/sys/windows/alloc.rs#L129-L178), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.
2022-09-04Don't duplicate file descriptors into stdio fdsbeetrees-1/+2
2022-09-03Forbid mixing `System` with sytem allocator callsChristopher Durham-1/+4
2022-09-03more clippy::perf fixesMatthias Krüger-1/+1
2022-09-03updated description of File struct in std::fsBart Massey-1/+1
2022-09-03std: make `ReentrantMutex` movable and `const`; simplify `Stdout` initializationjoboet-165/+39