about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2023-10-18Add discussion that concurrent access to the environment is unsafeTobias Bucher-10/+28
The bug report #27970 has existed for 8 years, the actual bug dates back to Rust pre-1.0. I documented it since it's in the interest of the user to be aware of it. The note can be removed once #27970 is fixed.
2023-10-18Rollup merge of #116856 - oli-obk:no_effects, r=compiler-errorsAli MJ Al-Nasrawy-1/+0
Disable effects in libcore again r? `@fee1-dead` This was accidentally allowed by https://github.com/rust-lang/rust/pull/114776 without feature gates
2023-10-17Automatically enable cross-crate inlining for small functionsBen Kimock-0/+2
2023-10-18Stabilize `result_option_inspect`Slanterns-13/+4
2023-10-17Disable effects in libcore againOli Scherer-1/+0
2023-10-17Auto merge of #115577 - RalfJung:atomic-load, r=Amanieubors-0/+34
document when atomic loads are guaranteed read-only Based on this [discussion in Zulip](https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Can.20.60Atomic*.3A.3Aload.60.20perform.20a.20write). The values for x86 and x86_64 are complete guesswork on my side, and I have no clue what the values might be for other architectures. I hope we can get the right people to chime in to gather the required information. :) I'll update Miri to respect these rules once we have more data.
2023-10-17Auto merge of #116518 - vita-rust:vita, r=workingjubileebors-5/+5
Updated libc and doc for Vita target Doc changes: - Updated Vita target readme. The recommended approach to build artifacts for the platform now is [cargo-vita](https://crates.io/crates/cargo-vita) which wraps all the convoluted steps previously described in a yaml for `cargo-make` - Updated maintainer list for Vita target. (`@ZetaNumbers` `@pheki` please agree to be added to the list, `@amg98` please let us know if you're still planning on actively maintaining target support) Code changes: - ~Updated libc for rust-lang/libc#3284 and rust-lang/libc#3366~ (Already merged in #116527) - In dupfd changed the flag same as for esp target, there is no CLOEXEC on Vita - Enabled `new_pair` since we've implemented `socketpair` in Vita newlib
2023-10-17Updated libc and doc for Vita targetNikolay Arhipov-5/+5
2023-10-17remove 128bit atomics, they are anyway not exposed on those targetsRalf Jung-2/+1
2023-10-16Auto merge of #116820 - GuillaumeGomez:rollup-l54ri5q, r=GuillaumeGomezbors-60/+30
Rollup of 6 pull requests Successful merges: - #116754 (coverage: Several small cleanups in `spans`) - #116798 (Improve display of parallel jobs in rustdoc-gui tester script) - #116800 (Fix implied outlives check for GAT in RPITIT) - #116805 (Make `rustc_onunimplemented` export path agnostic) - #116808 (Add myself to smir triage) - #116811 (Preserve unicode escapes in format string literals when pretty-printing AST) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-16Create `windows/api.rs` for safer FFIChris Denton-53/+212
2023-10-16Improve rewind documentationSean Linsley-0/+4
2023-10-16Make `rustc_onunimplemented` export path agnosticNilstrieb-60/+30
This makes it so that all the matchers that match against paths use the definition path instead of the export path. This removes all duplication around `std`/`alloc`/`core`. This is not necessarily optimal because we now depend on internal implementation details like `core::ops::control_flow::ControlFlow`, which is not very nice and probably not acceptable for a stable `on_unimplemented`. An alternative would be to just string-replace normalize away `alloc`/`core` to `std` as a special case, keeping the export paths but making it so that we're still fully standard library flavor agnostic.
2023-10-16use target-arch based tableRalf Jung-5/+4
2023-10-16Add invariant to Vec::pop that len < cap if pop successfulArthur Carcano-0/+1
Fixes: https://github.com/rust-lang/rust/issues/114334
2023-10-16Add `#[track_caller]` to `Option::unwrap_or_else`DaniPopes-0/+1
2023-10-16Auto merge of #116782 - matthiaskrgr:rollup-t3yrgku, r=matthiaskrgrbors-10/+13
Rollup of 3 pull requests Successful merges: - #115196 (Suggest adding `return` if the for semi which can coerce to the fn return type) - #115955 (Stabilize `{IpAddr, Ipv6Addr}::to_canonical`) - #116776 (Enable `review-requested` feature for rustbot) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-16Rollup merge of #115955 - tgross35:ip-to-canonical, r=dtolnayMatthias Krüger-10/+13
Stabilize `{IpAddr, Ipv6Addr}::to_canonical` Make `IpAddr::to_canonical` and `IpV6Addr::to_canonical` stable (+const), as well as const stabilize `Ipv6Addr::to_ipv4_mapped`. Newly stable API: ```rust impl IpAddr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; } impl Ipv6Addr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; // Already stable, this makes it const stable under // `const_ipv6_to_ipv4_mapped` const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> } ``` These stabilize a subset of the following tracking issues: - https://github.com/rust-lang/rust/issues/27709 - https://github.com/rust-lang/rust/issues/76205 Stabilization of all methods under the `ip` gate was attempted once at https://github.com/rust-lang/rust/pull/66584 then again at https://github.com/rust-lang/rust/pull/76098. These were not successful because there are still unknowns about `is_documentation` `is_benchmarking` and similar; `to_canonical` is much more straightforward. I have looked and could not find any known issues with `to_canonical`. These were added in 2021 in https://github.com/rust-lang/rust/pull/87708 cc implementor ``@the8472`` r? libs-api ``@rustbot`` label +T-libs-api +needs-fcp
2023-10-16Auto merge of #116775 - nnethercote:inline-Bytes-next, r=the8472bors-0/+2
Inline `Bytes::next` and `Bytes::size_hint`. This greatly increases its speed. On one small test program using `Bytes::next` to iterate over a large file, execution time dropped from ~330ms to ~220ms. r? `@the8472`
2023-10-16Auto merge of #114589 - ijackson:exit-code-default, r=dtolnaybors-1/+9
impl Default for ExitCode As suggested here https://github.com/rust-lang/rust/pull/106425#issuecomment-1382952598 Needs FCP since this is an insta-stable impl. Ideally we would have `impl From<ExitCode> for ExitStatus` and implement the default `ExitStatus` using that. That is sadly not so easy because of the various strange confusions about `ExitCode` (unix: exit status) vs `ExitStatus` (unix: wait status) in the not-really-unix platforms in `library//src/sys/unix/process`. I'll try to follow that up.
2023-10-15Auto merge of #113747 - clarfonthey:ip_bitops, r=dtolnaybors-0/+131
impl Not, Bit{And,Or}{,Assign} for IP addresses ACP: rust-lang/libs-team#235 Note: since these are insta-stable, these require an FCP. Implements, where `N` is either `4` or `6`: ```rust impl Not for IpvNAddr impl Not for &IpvNAddr impl BitAnd<IpvNAddr> for IpvNAddr impl BitAnd<&IpvNAddr> for IpvNAddr impl BitAnd<IpvNAddr> for &IpvNAddr impl BitAnd<&IpvNAddr> for &IpvNAddr impl BitAndAssign<IpvNAddr> for IpvNAddr impl BitAndAssign<&IpvNAddr> for IpvNAddr impl BitOr<IpvNAddr> for IpvNAddr impl BitOr<&IpvNAddr> for IpvNAddr impl BitOr<IpvNAddr> for &IpvNAddr impl BitOr<&IpvNAddr> for &IpvNAddr impl BitOrAssign<IpvNAddr> for IpvNAddr impl BitOrAssign<&IpvNAddr> for IpvNAddr ```
2023-10-15Auto merge of #116772 - matthiaskrgr:rollup-mpff3lh, r=matthiaskrgrbors-5/+169
Rollup of 7 pull requests Successful merges: - #116172 (Broaden the consequences of recursive TLS initialization) - #116341 (Implement sys::args for UEFI) - #116522 (use `PatKind::Error` when an ADT const value has violation) - #116732 (Make x capable of resolving symlinks) - #116755 (Remove me from libcore review rotation) - #116760 (Remove trivial cast in `guaranteed_eq`) - #116771 (Ignore let-chains formatting) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-16Inline `Bytes::next` and `Bytes::size_hint`.Nicholas Nethercote-0/+2
This greatly increases its speed.
2023-10-15Rollup merge of #116760 - Nilstrieb:triviality, r=oli-obkMatthias Krüger-1/+1
Remove trivial cast in `guaranteed_eq` I found this while accidentally breaking trivial casts in another branch. r? oli-obk
2023-10-15Rollup merge of #116341 - Ayush1325:uefi-args, r=Mark-SimulacrumMatthias Krüger-1/+165
Implement sys::args for UEFI - Uses `EFI_LOADED_IMAGE_PROTOCOL`, which is implemented for all loaded images. Tested on qemu with OVMF cc ``@nicholasbishop`` cc ``@dvdhrm``
2023-10-15Rollup merge of #116172 - joboet:recursive_tls_initialization, r=dtolnayMatthias Krüger-3/+3
Broaden the consequences of recursive TLS initialization This PR updates the documentation of `LocalKey` to clearly disallow the behaviour described in [this comment](https://github.com/rust-lang/rust/issues/110897#issuecomment-1525738849). This allows using `OnceCell` for the lazy initialization of TLS variables, which panics on reentrant initialization instead of updating the value like TLS variables currently do. ``@rustbot`` label +T-libs-api r? ``@m-ou-se``
2023-10-15Auto merge of #110604 - a1phyr:vecdeque_buf_read, r=dtolnaybors-0/+18
Implement `BufRead` for `VecDeque<u8>` Note: it would become insta-stable
2023-10-15Deduplicate std::process Default impl feature namesDavid Tolnay-2/+2
error[E0711]: feature `process-exitcode-default` is declared stable since 1.74.0-beta.1, but was previously declared stable since 1.73.0 --> library/std/src/process.rs:1964:1 | 1964 | #[stable(feature = "process-exitcode-default", since = "CURRENT_RUSTC_VERSION")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2023-10-15Auto merge of #110729 - ColinFinck:decode-utf16-fused-iterator, r=dtolnaybors-0/+4
Implement FusedIterator for DecodeUtf16 when the inner iterator does I have just implemented an iterator that wraps `DecodeUtf16` and wanted to implement `FusedIterator` for my iterator when I noticed that `DecodeUtf16` currently doesn't implement `FusedIterator` at all. A quick look at the code of `DecodeUtf16` revealed that `DecodeUtf16::next` only returns `None` when its inner iterator returns `None`: https://github.com/rust-lang/rust/blob/3462f79e94f466a56ddaccfcdd3a3d44dd1dda9f/library/core/src/char/decode.rs#L45 As a result, we can implement `FusedIterator` for `DecodeUtf16` when the inner iterator does. I'm following the example of #96397 here and consider this change minor and non-controversial, which is why I haven't added an RFC. I have also added the required feature name (`"decode_utf16_fused_iterator"`), however without adding a chapter to the Rust Unstable book (same as #96397).
2023-10-15acquire loads can be done as relaxed load; acquire fenceRalf Jung-0/+3
2023-10-15only guarantee for Relaxed; add ptr-size fallbackRalf Jung-18/+15
2023-10-15wordingRalf Jung-9/+13
2023-10-15define 'read-only memory'Ralf Jung-1/+8
2023-10-15add general powerpc64le boundRalf Jung-7/+8
(some powerpc64le targets can guarantee more, but for now it doesn't seem worth separating by OS/vendor)
2023-10-15add ARM and RISC-V valuesRalf Jung-3/+7
2023-10-15document when atomic loads are guaranteed read-onlyRalf Jung-0/+20
2023-10-15Auto merge of #116527 - sthibaul:libc, r=Mark-Simulacrumbors-1/+1
Bump libc dependency To get GNU/Hurd support, so that CI of external repositories (e.g. getrandom) can build std.
2023-10-15Implement args for UEFIAyush Singh-1/+165
- Uses `EFI_LOADED_IMAGE_PROTOCOL` - verify that cli args are valid UTF-16 - Update Docs Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-10-15Add tests for `SocketAddrV6` ordering with scope_id and flowinfoMaybe Waffle-0/+11
2023-10-15Remove trivial cast in `guaranteed_eq`Nilstrieb-1/+1
I found this while accidentally breaking trivial casts in another branch.
2023-10-15Make File::create work on Windows hidden filesChris Denton-7/+64
Previously it failed on Windows if the file had the `FILE_ATTRIBUTE_HIDDEN` attribute set. This was inconsistent with `OpenOptions::new().write(true).truncate(true)` which can truncate an existing hidden file.
2023-10-15Rollup merge of #116594 - tae-soo-kim:convert-tryfrom-doc, r=scottmcmMatthias Krüger-6/+5
Fix `std::convert::TryFrom` doc Original text: > truncating the [i64](https://doc.rust-lang.org/std/primitive.i64.html) to an [i32](https://doc.rust-lang.org/std/primitive.i32.html) (essentially giving the [i64](https://doc.rust-lang.org/std/primitive.i64.html)’s value modulo [i32::MAX](https://doc.rust-lang.org/std/primitive.i32.html#associatedconstant.MAX)) This can't be true, because `i32::MAX` is an odd number. The correct value seems `(i32::MAX + 1) * 2`, but this is complicated and distracting, and I suggest removing the parentheses entirely.
2023-10-15Auto merge of #116683 - ChrisDenton:exists, r=Mark-Simulacrumbors-0/+56
Make `try_exists` return `Ok(true)` for Windows Unix Sockets This is a follow up to #109106 but for[ `fs::try_exists`](https://doc.rust-lang.org/std/fs/fn.try_exists.html), which doesn't need to get the metadata of a file (which can fail even if a file exists). `fs::try_exists` currently fails on Windows if encountering a Unix Domain Socket (UDS). This PR fixes it by checking for an error code that's returned when there's a failure to use a reparse point. ## Reparse points A reparse point is a way to invoke a filesystem filter on a file instead of the file being opened normally. This is used to implement symbolic links (by redirecting to a different path) but also to implement other types of special files such as Unix domain sockets. If the reparse point is not a link type then opening it with `CreateFileW` may fail with `ERROR_CANT_ACCESS_FILE` because the filesystem filter does not implement that operation. This differs from resolving links which may fail with errors such as `ERROR_FILE_NOT_FOUND` or `ERROR_CANT_RESOLVE_FILENAME`. So `ERROR_CANT_ACCESS_FILE` means that the file exists but that we can't open it normally. Still, the file does exist on the filesystem so `try_exists` should report that as `Ok(true)`. r? libs
2023-10-15Auto merge of #115515 - the8472:zip-for-arrays, r=scottmcmbors-2/+121
optimize zipping over array iterators Fixes #115339 (somewhat) the new assembly: ```asm zip_arrays: .cfi_startproc vmovups (%rdx), %ymm0 leaq 32(%rsi), %rcx vxorps %xmm1, %xmm1, %xmm1 vmovups %xmm1, -24(%rsp) movq $0, -8(%rsp) movq %rsi, -88(%rsp) movq %rdi, %rax movq %rcx, -80(%rsp) vmovups %ymm0, -72(%rsp) movq $0, -40(%rsp) movq $32, -32(%rsp) movq -24(%rsp), %rcx vmovups (%rsi,%rcx), %ymm0 vorps -72(%rsp,%rcx), %ymm0, %ymm0 vmovups %ymm0, (%rsi,%rcx) vmovups (%rsi), %ymm0 vmovups %ymm0, (%rdi) vzeroupper retq ``` This is still longer than the slice version given in the issue but at least it eliminates the terrible `vpextrb`/`orb` chain. I guess this is due to excessive memcpys again (haven't looked at the llvmir)? The `TrustedLen` specialization is a drive-by change since I had to do something for the default impl anyway to be able to specialize the `TrustedRandomAccessNoCoerce` impl.
2023-10-14Add Seek::seek_relativeJonathan Behrens-0/+36
2023-10-14Rollup merge of #116540 - daxpedda:once-cell-lock-try-insert, r=Mark-SimulacrumGuillaume Gomez-12/+77
Implement `OnceCell/Lock::try_insert()` I took inspiration from [`once_cell`](https://crates.io/crates/once_cell): - [`once_cell::unsync::OnceCell::try_insert()`](https://github.com/matklad/once_cell/blob/874f9373abd7feaf923a3b3c34bfb3383529c671/src/lib.rs#L551-L563) - [`once_cell::sync::OnceCell::try_insert()`](https://github.com/matklad/once_cell/blob/874f9373abd7feaf923a3b3c34bfb3383529c671/src/lib.rs#L1080-L1087) I tried to change as little code as possible in the first commit and applied some obvious optimizations in the second one. ACP: https://github.com/rust-lang/libs-team/issues/276 Tracking issue: #116693
2023-10-14Rollup merge of #116723 - ivmarkov:master, r=dtolnayMatthias Krüger-4/+24
Fix broken build on ESP-IDF caused by #115108 `@ijackson` #115108 broke the build for ESP-IDF. I'm still checking whether this PR fixes everything - once I'm ready will remove the "Draft" status. `@dtolnay` FYI
2023-10-14Rollup merge of #115653 - joshlf:patch-9, r=dtolnayMatthias Krüger-0/+2
Guarantee that Layout::align returns a non-zero power of two
2023-10-14Fix broken build on ESP-IDF caused by #115108ivmarkov-4/+24
2023-10-14Auto merge of #116407 - Mark-Simulacrum:bootstrap-bump, r=onur-ozkanbors-149/+139
Bump bootstrap compiler to just-released beta https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday