about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2025-02-14Rollup merge of #136052 - no1wudi:fix, r=workingjubileeMatthias Krüger-1/+1
Correct comment for FreeBSD and DragonFly BSD in unix/thread
2025-02-14Add safe new to NotAllOnesKornel-29/+14
2025-02-13Rollup merge of #136908 - mustartt:aix-mutex-destory-einval, r=joboetJubilee-3/+3
[AIX] expect `EINVAL` for `pthread_mutex_destroy` Calling `pthread_mutex_destory` on a mutex initalized with the static initializer macro `PTHREAD_MUTEX_INITIALIZER` will result in `EINVAL` if the mutex is not lock/unlocked prior to calling `pthread_mutex_destroy`.
2025-02-14Implement `f{16,32,64,128}::{erf,erfc}`Pavel Grigorenko-0/+280
Also add ```rust // #[unstable(feature = "float_gamma", issue = "99842")] ``` to `gamma`-function-related methods on `f16` & `f128`, as per https://github.com/rust-lang/rust/pull/136324#issuecomment-2626270247
2025-02-13std: Apply deprecated_safe_2024Eric Huss-9/+15
2025-02-13std: Apply fixes for tail drop expressionsEric Huss-2/+2
2025-02-13std: Apply rust_2024_incompatible_patEric Huss-2/+2
2025-02-13std: Apply dependency_on_unit_never_type_fallbackEric Huss-1/+3
This generates a warning of irrefutable patterns. I decided to slightly tweak the example so the closure returns unit, since the intent wasn't to show the weird behavior of returning `!`.
2025-02-13std: Apply missing_unsafe_on_externEric Huss-2/+2
2025-02-13std: Apply unsafe_attr_outside_unsafeEric Huss-28/+28
2025-02-13Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviperbors-1/+0
Stabilize `get_many_mut` as `get_disjoint_mut` Tracking issue: #104642 Closes #104642 FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13Consistently using as_mut_ptr() and as_ptr() in threadxizheyin-8/+11
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-13Replace mem::zeroed with mem::MaybeUninit::uninit for large struct in unixxizheyin-13/+31
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-02-13Use `slice::fill` in `io::Repeat` implementationDaniPopes-18/+11
Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-13Windows: Update generated bindings to 0.59Chris Denton-2734/+2770
2025-02-12Rollup merge of #136945 - samueltardieu:push-rsqlyknnvyqm, r=fmeaseJacob Pratt-0/+1
Add diagnostic item for `std::io::BufRead` This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-12Rollup merge of #136818 - a1phyr:io_repeat_exact, r=jhprattJacob Pratt-0/+11
Implement `read*_exact` for `std:io::repeat` cc #136756
2025-02-12Rollup merge of #136699 - joboet:netaddr_from_inner, r=cuviperJacob Pratt-348/+155
std: replace the `FromInner` implementation for addresses with private conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
2025-02-12Add diagnostic item for `std::io::BufRead`Samuel Tardieu-0/+1
This will be used in Clippy to detect unbuffered calls to `Read::bytes()`.
2025-02-12std: replace the `FromInner` implementation for addresses with private ↵joboet-348/+155
conversion functions Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
2025-02-12Auto merge of #136918 - GuillaumeGomez:rollup-f6h21gg, r=GuillaumeGomezbors-2/+2
Rollup of 8 pull requests Successful merges: - #134981 ( Explain that in paths generics can't be set on both the enum and the variant) - #136698 (Replace i686-unknown-redox target with i586-unknown-redox) - #136767 (improve host/cross target checking) - #136829 ([rustdoc] Move line numbers into the `<code>` directly) - #136875 (Rustc dev guide subtree update) - #136900 (compiler: replace `ExternAbi::name` calls with formatters) - #136913 (Put kobzol back on review rotation) - #136915 (documentation fix: `f16` and `f128` are not double-precision) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-12Auto merge of #136897 - workingjubilee:revert-unfcped-stab, r=WaffleLapkinbors-0/+3
Revert "Stabilize `extended_varargs_abi_support`" I cannot find an FCP for this, despite it being a stabilization PR which normally means we do an FCP of some kind? It would seem reasonable for _either_ compiler or lang to have FCPed it? I am thus opening a revert PR, which mostly-cleanly applies, so that we can later actually land this properly with a stability report and FCP. - https://github.com/rust-lang/rust/issues/136896 - https://github.com/rust-lang/rust/pull/116161 - https://github.com/rust-lang/rust/issues/100189
2025-02-12`f128` is quadruple-precisioneyelash-1/+1
2025-02-12`f16` is half-precisioneyelash-1/+1
2025-02-12expect EINVAL for pthread_mutex_destroy for aixHenry Jiang-3/+3
2025-02-11library: amend revert of extended_varargs_abi_support for beta diffJubilee Young-1/+3
And leave a comment on the unusual `cfg_attr` Co-authored-by: waffle <waffle.lapkin@gmail.com>
2025-02-11Revert "Stabilize `extended_varargs_abi_support`"Jubilee Young-0/+1
This reverts commit 685f189b4307435b83d625fea397ef36dff4e955.
2025-02-11Remove the common prelude moduleEric Huss-12/+6
This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems.
2025-02-11Document that locking a file fails on Windows if the file is opened only for ↵Josh Triplett-0/+15
append
2025-02-11Reword file lock documentation to clarify advisory vs mandatoryJosh Triplett-35/+40
Remove the word "advisory", and make it more explicit that the lock may be advisory or mandatory depending on platform.
2025-02-11Rollup merge of #136354 - hkBst:patch-34, r=ibraheemdevMatthias Krüger-7/+34
Update docs for impl keyword This started as a fix for #79878, but also introduces some structure (headings), and elaborates a tiny bit on impl Trait syntax.
2025-02-11Update docs for impl keywordMarijn Schouten-7/+34
2025-02-11Rollup merge of #136704 - benschulz:patch-1, r=ibraheemdevJacob Pratt-2/+2
Improve examples for file locking The `lock` and `try_lock` documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use `File::create` instead of `File::open`, eliminating the possibility of someone blindly copying code with unspecified behavior.
2025-02-10Fix long lines which rustfmt fails to formatThalia Archibald-106/+45
rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues #3863 (Gives up on chains if any line is too long) and #3156 (Fail to format match arm when other arm has long line).
2025-02-10Fix &&str and trailing commas in io::const_error!Thalia Archibald-91/+75
2025-02-10Use io::const_error! when possible over io::Error::newThalia Archibald-10/+9
2025-02-10Implement `read*_exact` for `std:io::repeat`Benoît du Garreau-0/+11
cc #136756
2025-02-10Rollup merge of #136705 - compiler-errors:edition-library, r=jhprattJubilee-75/+75
Some miscellaneous edition-related library tweaks Some library edition tweaks that can be done separately from upgrading the whole standard library to edition 2024 (which is blocked on getting the submodules upgraded, for example)
2025-02-10Rollup merge of #136552 - ChrisDenton:option-find-handle, r=Mark-SimulacrumJubilee-10/+6
Use an `Option` for `FindNextFileHandle` in `ReadDir` instead of `INVALID_FILE_HANDLE` sentinel value Sometimes we store an invalid handle when we don't want to return an error. We then check the handle before use in order to avoid actually using the invalid handle. However, using an `Option` for this is better and avoids us forgetting to check the handle is valid. This was noticed due to us closing the handle without checking for validity: https://github.com/rust-lang/rust/blob/bd6a6777f5cbbec549f123995026cef76d1e6b84/library/std/src/sys/pal/windows/fs.rs#L148-L151
2025-02-09Stabilize file_lockChristopher Berner-10/+5
2025-02-09Fix pattern matching mode changes and unsafe_op_in_unsafe_fnMichael Goulet-3/+3
2025-02-09Mark extern blocks as unsafeMichael Goulet-69/+69
2025-02-09Mark link_section attr with unsafeMichael Goulet-3/+3
2025-02-09Auto merge of #136751 - bjorn3:update_rustfmt, r=Mark-Simulacrumbors-110/+120
Update bootstrap compiler and rustfmt The rustfmt version we previously used formats things differently from what the latest nightly rustfmt does. This causes issues for subtrees that get formatted both in-tree and in their own repo. Updating the rustfmt used in-tree solves those issues. Also bumped the bootstrap compiler as the stage0 update command always updates both at the same time.
2025-02-09Auto merge of #136754 - Urgau:rollup-qlkhjqr, r=Urgaubors-6/+44
Rollup of 5 pull requests Successful merges: - #134679 (Windows: remove readonly files) - #136213 (Allow Rust to use a number of libc filesystem calls) - #136530 (Implement `x perf` directly in bootstrap) - #136601 (Detect (non-raw) borrows of null ZST pointers in CheckNull) - #136659 (Pick the max DWARF version when LTO'ing modules with different versions ) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-08Rollup merge of #136686 - bjoernager:master, r=jhprattJubilee-8/+8
Clean up `HashMap` and `HashSet` docs. This commit makes some small, pedantic changes to the docs for `HashMap` and `HashSet`, which fixes that: * "HashMap" is not always formatted as code (as in `HashMap`), and that * `HashSet` sometimes references `HashMap` instead of itself.
2025-02-09Rollup merge of #136213 - erickt:fs, r=Mark-SimulacrumUrgau-1/+17
Allow Rust to use a number of libc filesystem calls This allows Rust on Fuchsia to use a number of function calls from libc: * dirfd * fdatasync * flock with LOCK_EX, LOCK_SH, LOCK_NB, LOCK_UN * fstatat cc #120426 try-job: dist-various-2
2025-02-09Rollup merge of #134679 - ChrisDenton:rm-readonly, r=Mark-SimulacrumUrgau-5/+27
Windows: remove readonly files When calling `remove_file`, we shouldn't fail to delete readonly files. As the test makes clear, this make the Windows behaviour consistent with other platforms. This also makes us internally consistent with `remove_dir_all`. try-job: x86_64-msvc-ext1
2025-02-08Rustfmtbjorn3-110/+120
2025-02-08Rollup merge of #135696 - joboet:move_pal_io, r=NoratriebMatthias Krüger-317/+164
std: move `io` module out of `pal`, get rid of `sys_common::io` Part of #117276. This does two related things: 1. It moves the platform-specific definitions for `IoSlice`, `IoSliceMut` and `is_terminal` out of `pal` and into `sys` and unifies some of them. 2. It gets rid of `sys_common::io`, moving the non-platform-specific test helpers into `std::test_helpers` and the buffer size definition to the new `sys::io` module.