about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-09-19Document surprising and dangerous fs::Permissions behaviour on UnixTim Hutt-3/+64
This documents the very surprising behaviour that `set_readonly(false)` will make a file *world writable* on Unix. I would go so far as to say that this function should be deprecated on Unix, or maybe even entirely. But documenting the bad behaviour is a good first step.
2022-09-18Move `unix_socket_abstract` feature API to `SocketAddrExt`.John Millikin-83/+123
2022-09-18Adjust `tcp_quickack` feature to allow other `os::linux::net` features.John Millikin-12/+17
2022-09-17Rollup merge of #101672 - idigdoug:array_try_into, r=Mark-SimulacrumMatthias Krüger-1/+22
array docs - advertise how to get array from slice On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly. (As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
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-14Made from_waker, waker, from_raw consty86-dev-0/+1
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-11std: use correct clock in `park_timeout` on Horizonjoboet-2/+4
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-10array docs - advertise how to get array from sliceDoug Cook (WINDOWS)-1/+22
On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly. (As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
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-10Better documentation for env::home_dir()'s broken behaviourTim Hutt-1/+8
This improves the documentation to say *why* it was deprecated. The reason was because it reads `HOME` on Windows which is meaningless there. Note that the PR that deprecated it stated that returning an empty string if `HOME` is set to an empty string was a problem, however I can find no evidence that this is the case. `cd` handles it fine whereas if `HOME` is unset it gives an explicit `HOME not set` error. * Original deprecation reason: https://internals.rust-lang.org/t/deprecate-or-break-fix-std-env-home-dir/7315 * Original deprecation PR: https://github.com/rust-lang/rust/pull/51656 See #71684
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-07Stabilize `#![feature(mixed_integer_ops)]`Jacob Pratt-1/+0
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: clarify semantics of SGX parkerjoboet-15/+29
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-04Make code worling w/ pointers in ↵Maybe Waffle-14/+14
`library/std/src/sys/sgx/abi/usercalls/alloc.rs` nicer - Use `.addr()` instead of `as`-cast - Use `add` instead of `offset` and remove some `as isize` casts by doing that - Remove some casts
2022-09-04Don't duplicate file descriptors into stdio fdsbeetrees-1/+2