Commit graph

15297 commits

Author SHA1 Message Date
Pavel Grigorenko 84474a25a4 Small fixme in core now that NonZero is generic 2024-06-24 17:42:08 +03:00
joboet 50a02ed789
std: fix wasm builds 2024-06-24 16:37:09 +02:00
Matthias Krüger 94b9ea417d
Rollup merge of #126213 - zachs18:atomicbool-u8-i8-from-ptr-alignment, r=Nilstrieb
Update docs for AtomicBool/U8/I8 with regard to alignment

Fixes #126084.

Since `AtomicBool`/`AtomicU8`/`AtomicI8` are guaranteed to have size == 1, and Rust guarantees that `size % align == 0`, they also must have alignment equal to 1, so some current docs are contradictory/confusing when describing their alignment requirements.

Specifically:

* Fix `AtomicBool::from_ptr` claiming that `align_of::<AtomicBool>() > align_of::<bool>()` on some platforms. (same for `AtomicU8::from_ptr`/`AtomicI8::from_ptr`)
* Explicitly state that `AtomicU8`/`AtomicI8` have the same alignment as `u8`/`i8` (in addition to size and bit validity)
* (internal) Change the `if_not_8_bit` macro to be `if_8_bit` and to allow an "if-else"-like structure, instead of just "if"-like.

---

I opted to leave the "`ptr` must be aligned" wording in `from_ptr`'s docs and just clarify that it is always satsified, instead of just removing the wording entirely. If that is instead preferred I can do that.
2024-06-24 15:06:21 +02:00
Trevor Gross 0314fe62bd Reword docs for f32 and f64
Better explain the reasoning for the `next_up`/`next_down` integer
implementation, as requested by Ralf.
2024-06-24 00:42:21 -05:00
Trevor Gross fce07a82c6 Extract repeated constants from f32 and f64 source
This will make it easier to keep `f16` and `f128` consistent as their
implementations get added.
2024-06-24 00:42:21 -05:00
Matthias Krüger 9892b3e9fe
Rollup merge of #126854 - devnexen:std_unix_os_fallback_upd, r=Mark-Simulacrum
std::unix::os::home_dir: fallback's optimisation.

we're using a guaranteed initialised field on success.
2024-06-24 06:27:16 +02:00
Matthias Krüger 21850f5bd8
Rollup merge of #126807 - devnexen:copy_file_macos_simpl, r=Mark-Simulacrum
std::unix::fs: copy simplification for apple.

since we do support from macOs Sierra, we avoid the little runtime overhead with the fclonefileat symbol check.
2024-06-24 06:27:14 +02:00
Scott McMurray ec9e35618d Also get add nuw from uN::checked_add 2024-06-23 13:29:06 -07:00
Xiangfei Ding f1be59fa72
SmartPointer derive-macro
Co-authored-by: Wedson Almeida Filho <walmeida@microsoft.com>
2024-06-24 03:03:34 +08:00
David Carlier fc50acae90
fix build 2024-06-23 09:56:02 +01:00
Matthias Krüger 08d2fc7c51
Rollup merge of #126783 - tguichaoua:fix_tcplistener_into_incoming_issue_number, r=workingjubilee
Fix issue number for the `tcplistener_into_incoming` feature

As per [this comment](https://github.com/rust-lang/rust/pull/88339#discussion_r922899044), the issue number for the `tcplistener_into_incoming` feature is the one of the PR that implements it instead of the tracking issue.

- https://github.com/rust-lang/rust/pull/88339
- https://github.com/rust-lang/rust/issues/88373
2024-06-23 09:45:29 +02:00
David Carlier bd9ce3e074
std::unix::os::home_dir: fallback's optimisation.
we're using a guaranteed initialised field on success.
2024-06-23 08:22:51 +01:00
bors a0f01c3c10 Auto merge of #126838 - matthiaskrgr:rollup-qkop22o, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #126140 (Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists)
 - #126318 (Add a `x perf` command for integrating bootstrap with `rustc-perf`)
 - #126552 (Remove use of const traits (and `feature(effects)`) from stdlib)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-22 18:48:10 +00:00
Matthias Krüger dc9a08f535
Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errors
Remove use of const traits (and `feature(effects)`) from stdlib

The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands.

Also, make `effects` an incomplete feature.

cc `@rust-lang/project-const-traits`
r? `@compiler-errors`
2024-06-22 19:33:56 +02:00
Matthias Krüger f3ced9d540
Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu
Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists

FCP completed in tracking issue.

Tracking issue: https://github.com/rust-lang/rust/issues/83186

Closes https://github.com/rust-lang/rust/issues/83186

Stabilized API:

```rust
mod fs {
    pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>;
}
```
2024-06-22 19:33:55 +02:00
bors f944afe380 Auto merge of #116113 - kpreid:arcmut, r=dtolnay
Generalize `{Rc,Arc}::make_mut()` to unsized types.

* `{Rc,Arc}::make_mut()` now accept any type implementing the new unstable trait `core::clone::CloneToUninit`.
* `CloneToUninit` is implemented for `T: Clone` and for `[T] where T: Clone`.
* `CloneToUninit` is a generalization of the existing internal trait `alloc::alloc::WriteCloneIntoRaw`.
* New feature gate: `clone_to_uninit`

This allows performing `make_mut()` on `Rc<[T]>` and `Arc<[T]>`, which was not previously possible.

---

Previous PR description, now obsolete:

>  Add `{Rc, Arc}::make_mut_slice()`
>
> These functions behave identically to `make_mut()`, but operate on `Arc<[T]>` instead of `Arc<T>`.
>
> This allows performing the operation on slices, which was not previously possible because `make_mut()` requires `T: Clone` (and slices, being `!Sized`, do not and currently cannot implement `Clone`).
>
> Feature gate: `make_mut_slice`

try-job: test-various
2024-06-22 16:35:29 +00:00
Kevin Reid 88c3db57e4 Generalize {Rc,Arc}::make_mut() to unsized types.
This requires introducing a new internal type `RcUninit` (and
`ArcUninit`), which can own an `RcBox<T>` without requiring it to be
initialized, sized, or a slice. This is similar to `UniqueRc`, but
`UniqueRc` doesn't support the allocator parameter, and there is no
`UniqueArc`.
2024-06-22 08:08:00 -07:00
Kevin Reid a9a4830d25 Replace WriteCloneIntoRaw with CloneToUninit. 2024-06-22 08:08:00 -07:00
Kevin Reid ec201b8650 Add core::clone::CloneToUninit.
This trait allows cloning DSTs, but is unsafe to implement and use
because it writes to possibly-uninitialized memory which must be of the
correct size, and must initialize that memory.

It is only implemented for `T: Clone` and `[T] where T: Clone`, but
additional implementations could be provided for specific `dyn Trait`
or custom-DST types.
2024-06-22 08:08:00 -07:00
bors d03d6c0fea Auto merge of #126750 - scottmcm:less-unlikely, r=jhpratt
Stop using `unlikely` in `strict_*` methods

The `strict_*` methods don't need (un)likely, because the `overflow_panic` calls are all `#[cold]`, [meaning](https://llvm.org/docs/LangRef.html#function-attributes) that LLVM knows any branch to them is unlikely without us needing to say so.

r? libs
2024-06-22 10:54:53 +00:00
bors 10e1f5d212 Auto merge of #124101 - the8472:pidfd-methods, r=cuviper
Add PidFd::{kill, wait, try_wait}

#117957 changed `Child` kill/wait/try_wait to use its pidfd instead of the pid, when one is available.
This PR extracts those implementations and makes them available on `PidFd` directly.

The `PidFd` implementations differ significantly from the corresponding `Child` methods:

* the methods can be called after the child has been reaped, which will result in an error but will be safe. This state is not observable in `Child` unless something stole the zombie child
* the `ExitStatus` is not kept, meaning that only the first time a wait succeeds it will be returned
* `wait` does not close stdin
* `wait` only requires `&self` instead of `&mut self` since there is no state to maintain and subsequent calls are safe

Tracking issue: #82971
2024-06-22 03:35:52 +00:00
The 8472 8abf149bde to extract a pidfd we must consume the child
As long as a pidfd is on a child it can be safely reaped. Taking it
would mean the child would now have to be awaited through its pid, but could also
be awaited through the pidfd. This could then suffer from a recycling race.
2024-06-22 00:46:55 +02:00
The 8472 0787c7308c Add PidFd::{kill, wait, try_wait} 2024-06-22 00:46:55 +02:00
David Carlier 65530ba100
std::unix::fs: copy simplification for apple.
since we do support from macOs Sierra, we avoid the little runtime overhead
with the fclonefileat symbol check.
2024-06-21 21:22:57 +01:00
bors 5ced3dad57 Auto merge of #125853 - tesuji:promote-fail-fast, r=cjgillot
promote_consts: some clean-up after experimenting

This is some clean-up after experimenting in #125916,
Prefer to review commit-by-commit.
2024-06-21 16:00:14 +00:00
Deadbeef 02aaea1803 update intrinsic const param counting 2024-06-21 09:23:54 +00:00
Deadbeef 3b14b756d8 Remove feature(effects) from the standard library 2024-06-21 09:23:24 +00:00
bors d40f30e1df Auto merge of #126781 - matthiaskrgr:rollup-5u4pens, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #126125 (Improve conflict marker recovery)
 - #126481 (Add `powerpc-unknown-openbsd` maintenance status)
 - #126613 (Print the tested value in int_log tests)
 - #126617 (Expand `avx512_target_feature` to include VEX variants)
 - #126700 (Make edition dependent `:expr` macro fragment act like the edition-dependent `:pat` fragment does)
 - #126707 (Pass target to inaccessible-temp-dir rmake test)
 - #126767 (`StaticForeignItem` and `StaticItem` are the same)
 - #126774 (Fix another assertion failure for some Expect diagnostics.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-21 09:22:09 +00:00
Tristan Guichaoua af9f632be7 fix issue number 2024-06-21 10:57:07 +02:00
Matthias Krüger 7a827d349f
Rollup merge of #126613 - tgross35:log-test-update, r=cuviper
Print the tested value in int_log tests

Tiny change - from the failures in https://github.com/rust-lang/rust/pull/125016, it would have been nice to see what the tested values were. Update the assertion messages.
2024-06-21 09:12:35 +02:00
Scott McMurray a314f7363a Stop using unlikely in strict_* methods
It's unnecessary when that arm leads to a `#[cold]` panic anyway, since controlling branch likihood is what `#[cold]` is all about.

(And, well, it's unclear whether `unlikely!` even works these days anyway.)
2024-06-20 23:58:26 -07:00
Scott McMurray 55d13379ac [GVN] Add tests for generic pointees with PtrMetadata 2024-06-20 22:16:59 -07:00
bors 7a08f84627 Auto merge of #126578 - scottmcm:inlining-bonuses-too, r=davidtwco
Account for things that optimize out in inlining costs

This updates the MIR inlining `CostChecker` to have both bonuses and penalties, rather than just penalties.

That lets us add bonuses for some things where we want to encourage inlining without risking wrapping into a gigantic cost.  For example, `switchInt(const …)` we give an inlining bonus because codegen will actually eliminate the branch (and associated dead blocks) once it's monomorphized, so measuring both sides of the branch gives an unrealistically-high cost to it.  Similarly, an `unreachable` terminator gets a small bonus, because whatever branch leads there doesn't actually exist post-codegen.
2024-06-21 02:06:27 +00:00
bors 684b3553f7 Auto merge of #124032 - Voultapher:a-new-sort, r=thomcc
Replace sort implementations

This PR replaces the sort implementations with tailor-made ones that strike a balance of run-time, compile-time and binary-size, yielding run-time and compile-time improvements. Regressing binary-size for `slice::sort` while improving it for `slice::sort_unstable`. All while upholding the existing soft and hard safety guarantees, and even extending the soft guarantees, detecting strict weak ordering violations with a high chance and reporting it to users via a panic.

* `slice::sort` -> driftsort [design document](https://github.com/Voultapher/sort-research-rs/blob/main/writeup/driftsort_introduction/text.md), includes detailed benchmarks and analysis.

* `slice::sort_unstable` -> ipnsort [design document](https://github.com/Voultapher/sort-research-rs/blob/main/writeup/ipnsort_introduction/text.md), includes detailed benchmarks and analysis.

#### Why should we change the sort implementations?

In the [2023 Rust survey](https://blog.rust-lang.org/2024/02/19/2023-Rust-Annual-Survey-2023-results.html#challenges), one of the questions was: "In your opinion, how should work on the following aspects of Rust be prioritized?". The second place was "Runtime performance" and the third one "Compile Times". This PR aims to improve both.

#### Why is this one big PR and not multiple?

* The current documentation gives performance recommendations for `slice::sort` and `slice::sort_unstable`. If for example only one of them were to be changed, this advice would be misleading for some Rust versions. By replacing them atomically, the advice remains largely unchanged, and users don't have to change their code.
* driftsort and ipnsort share a substantial part of their implementations.
* The implementation of `select_nth_unstable` uses internals of `slice::sort_unstable`, which makes it impractical to split changes.

---

This PR is a collaboration with `@orlp.`
2024-06-20 20:40:43 +00:00
Matthias Krüger b0b2082432
Rollup merge of #126737 - fee1-dead-contrib:rm-const-closures, r=compiler-errors
Remove `feature(const_closures)` from libcore

This is an incomplete feature and apparently it has no uses in `core`. Incomplete features should generally not be used in our standard library.
2024-06-20 18:20:13 +02:00
Lukas Bergdoll a895ef77f0 Fix wrong big O star bracing in the doc comments 2024-06-20 18:07:04 +02:00
Deadbeef d3091df79b Remove feature(const_closures) from libcore 2024-06-20 15:15:48 +00:00
bors 1ca578e68e Auto merge of #126736 - matthiaskrgr:rollup-rb20oe3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #126380 (Add std Xtensa targets support)
 - #126636 (Resolve Clippy `f16` and `f128` `unimplemented!`/`FIXME`s )
 - #126659 (More status-quo tests for the `#[coverage(..)]` attribute)
 - #126711 (Make Option::as_[mut_]slice const)
 - #126717 (Clean up some comments near `use` declarations)
 - #126719 (Fix assertion failure for some `Expect` diagnostics.)
 - #126730 (Add opaque type corner case test)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-20 13:36:42 +00:00
Matthias Krüger ef2e8bfcbf
Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxu
Clean up some comments near `use` declarations

#125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge.

r? ``@lqd``
2024-06-20 14:07:04 +02:00
Matthias Krüger 7b91d11abb
Rollup merge of #126711 - GKFX:const-option-as-slice, r=oli-obk
Make Option::as_[mut_]slice const

These two functions can both be made `const`. I have added them to the `const_option_ext` feature, #91930. I don't believe there is anything blocking stabilization of `as_slice`, but `as_mut_slice` contains mutable references so depends on `const_mut_refs`.
2024-06-20 14:07:03 +02:00
bors 1aaab8b9f8 Auto merge of #116088 - nbdd0121:unwind, r=Amanieu,RalfJung
Stabilise `c_unwind`

Fix #74990
Fix #115285 (that's also where FCP is happening)

Marking as draft PR for now due to `compiler_builtins` issues

r? `@Amanieu`
2024-06-20 11:22:59 +00:00
Matthias Krüger af073e4e88
Rollup merge of #126703 - the8472:on-blackbox-crypto-use, r=scottmcm
reword the hint::blackbox non-guarantees

People were tripped up by the "precludes", interpreting it that this function must not ever be used in cryptographic contexts rather than the std lib merely making zero promises about it being fit-for-purpose.

What remains unchanged is that if someone does try to use it *despite the warnings* then it is on them to pin their compiler versions and verify the assembly of every single binary build they do.
2024-06-20 07:52:45 +02:00
Scott McMurray eac6b2910a Shrink some slice iterator MIR 2024-06-19 21:35:37 -07:00
Nicholas Nethercote b104fbec85 Add blank lines after module-level // comments.
Similar to the previous commit.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote 665821cb60 Add blank lines after module-level //! comments.
Most modules have such a blank line, but some don't. Inserting the blank
line makes it clearer that the `//!` comments are describing the entire
module, rather than the `use` declaration(s) that immediately follows.
2024-06-20 09:23:20 +10:00
Nicholas Nethercote 09006d6a88 Convert some module-level // and /// comments to //!.
This makes their intent and expected location clearer. We see some
examples where these comments were not clearly separate from `use`
declarations, which made it hard to understand what the comment is
describing.
2024-06-20 09:23:18 +10:00
George Bateman 35c65a8c0c
Make Option::as_[mut_]slice const 2024-06-19 21:44:47 +01:00
The 8472 95e214d6e5 reword the hint::blackbox non-guarantees
People were tripped up by the "precludes", interpreting it that this function
must not ever be used in cryptographic contexts rather than the std lib merely
making zero promises about it being fit-for-purpose.

What remains unchanged is that if someone does try to use it *despite the warnings*
then it is on them to pin their compiler versions and verify the assembly of every
single binary build they do.
2024-06-19 20:01:32 +02:00
joboet e1aacea74d
core: add tracking issue for array::repeat 2024-06-19 17:48:00 +02:00
joboet 39a918002e
core: simplify implementation of array::repeat, address other nits 2024-06-19 17:29:54 +02:00
joboet 8aa24572f0
core: implement UncheckedIterator for RepeatN 2024-06-19 17:29:54 +02:00
joboet 3d4f8b1f45
core: implement array::repeat 2024-06-19 17:29:53 +02:00
Gary Guo da8ac73d91 Add a hack to prevent proc_macro misopt in CI 2024-06-19 13:54:55 +01:00
Gary Guo ebdfcd93a3 Stabilise c_unwind 2024-06-19 13:54:51 +01:00
Vonr 7321e79114
Replace move|| with move || in compiler/ and library/
Edit from #126631 to revert changes on ui tests
2024-06-18 23:25:08 +08:00
bors f873ae029e Auto merge of #126330 - m-ou-se:panic-message-type, r=Amanieu
Return opaque type from PanicInfo::message()

This changes the return type of the (unstable) PanicInfo::message() method to an opaque type (that implements Display). This allows for a bit more flexibility in the future.

See https://github.com/rust-lang/rust/issues/66745
2024-06-18 07:20:26 +00:00
Trevor Gross c4ddc863ae Print the tested value in int_log tests 2024-06-17 19:19:41 -05:00
Lukas Bergdoll b7deff3a0d Add missing CopyMarker impl
Due to refactoring the const_trait usage, the CopyMarker impl was
accidentally deleted, which had the consequence that the Copy
specialization for the small-sort was never picked.
2024-06-17 22:32:01 +02:00
Lukas Bergdoll 732616998c Revert panic_safe test changes
The changes made only a limited improvement for the current small
miri coverage and in general test coverage of the sort implementations.
But they exploded test times from ~13s to ~240s, which is not deemed
worth it.
2024-06-17 22:05:35 +02:00
Mara Bos 6c2507cab5 Add PanicMessage type for PanicInfo::message(). 2024-06-17 20:44:55 +02:00
Daria Sukhonina a6a78d28e6 Add tracking issue to async_drop API 2024-06-17 17:20:13 +03:00
joboet 32f9b8bf76
std: rename module for clarity 2024-06-17 15:59:42 +02:00
joboet 35f050b8da
std: update TLS module documentation 2024-06-17 15:58:06 +02:00
joboet b2f29edc81
std: use the c_int from core::ffi instead of libc 2024-06-17 12:45:10 +02:00
joboet d70f071392
std: simplify #[cfg]s for TLS 2024-06-17 12:41:41 +02:00
Lukas Bergdoll 032ad4c4c6 Fix unintended regression for Freeze + Copy types
Freeze + Copy types should be allowed to choose between all three
small-sort variants. With the recent changes to small-sort selection,
a regression was added that only let such types choose between network
and fallback. It can now also choose general where appropriate.
2024-06-17 07:28:18 +02:00
bors fd7eefc275 Auto merge of #126569 - jieyouxu:rollup-1uvkb2y, r=jieyouxu
Rollup of 8 pull requests

Successful merges:

 - #125258 (Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope)
 - #126250 (docs(change): Don't mention a Cargo 2024 edition change for 1.79)
 - #126288 (doc: Added commas where needed)
 - #126346 (export std::os::fd module on HermitOS)
 - #126468 (div_euclid, rem_euclid: clarify/extend documentation)
 - #126531 (Add codegen test for `Request::provide_*`)
 - #126535 (coverage: Arrange span extraction/refinement as a series of passes)
 - #126538 (coverage: Several small improvements to graph code)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-17 04:01:54 +00:00
许杰友 Jieyou Xu (Joe) 61577a8734
Rollup merge of #126531 - slanterns:error_provider, r=workingjubilee
Add codegen test for `Request::provide_*`

Codegen before & after https://github.com/rust-lang/rust/pull/126242: https://gist.github.com/slanterns/3789ee36f59ed834e1a6bd4677b68ed4.

Also adjust an outdated comment since `tag_id` is no longer attached to `TaggedOption` via `Erased`, but stored next to it in `Tagged` under the new implementation.

My first time writing FileCheck xD. Correct me if there is anything that should be amended.

r? libs
2024-06-17 04:53:57 +01:00
许杰友 Jieyou Xu (Joe) f39327bcf2
Rollup merge of #126468 - RalfJung:euclid, r=Mark-Simulacrum
div_euclid, rem_euclid: clarify/extend documentation
2024-06-17 04:53:56 +01:00
许杰友 Jieyou Xu (Joe) cd4c0f06da
Rollup merge of #126346 - hermit-os:fd, r=Amanieu
export std::os::fd module on HermitOS

The HermitOS' IO interface is similiar to Unix. Consequently, this PR synchronize the FD implementation between both.

closes #126198
2024-06-17 04:53:56 +01:00
许杰友 Jieyou Xu (Joe) a8ccf97445
Rollup merge of #126288 - x4exr:patch-1, r=dtolnay
doc: Added commas where needed

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-06-17 04:53:55 +01:00
bors e794b0f855 Auto merge of #125720 - folkertdev:optimize_for_size-ptr-rotate, r=Amanieu
make `ptr::rotate` smaller when using `optimize_for_size`

code to reproduce https://github.com/folkertdev/optimize_for_size-slice-rotate

In the example the size of `.text` goes down from 1624 to 276 bytes.

```
> cargo size --release --features "left-std"  -- -A

slice-rotate  :
section              size        addr
.vector_table        1024         0x0
.text                1624       0x400
.rodata                 0       0xa58
.data                   0  0x20000000
.gnu.sgstubs            0       0xa60
.bss                    0  0x20000000
.uninit                 0  0x20000000
.debug_loc            591         0x0
.debug_abbrev        1452         0x0
.debug_info         10634         0x0
.debug_aranges        480         0x0
.debug_ranges        1504         0x0
.debug_str          11716         0x0
.comment               72         0x0
.ARM.attributes        56         0x0
.debug_frame         1036         0x0
.debug_line          5837         0x0
Total               36026

> cargo size --release --features "left-size"  -- -A

slice-rotate  :
section             size        addr
.vector_table       1024         0x0
.text                276       0x400
.rodata                0       0x514
.data                  0  0x20000000
.gnu.sgstubs           0       0x520
.bss                   0  0x20000000
.uninit                0  0x20000000
.debug_loc           347         0x0
.debug_abbrev        965         0x0
.debug_info         4216         0x0
.debug_aranges       168         0x0
.debug_ranges        216         0x0
.debug_str          3615         0x0
.comment              72         0x0
.ARM.attributes       56         0x0
.debug_frame         232         0x0
.debug_line          723         0x0
Total              11910
```

tracking issue: https://github.com/rust-lang/rust/issues/125612
2024-06-17 01:45:22 +00:00
Rayyan Khan fe9154c64e
doc: Added commas where needed 2024-06-16 15:58:44 -07:00
Lukas Bergdoll 24697ac66b Fix doc-link issue 2024-06-16 20:26:33 +02:00
Lukas Bergdoll 9889ab1f60 Remove reliance on const_trait in sort implementations
const_trait in conjunction with specialization was
deemed not ready for usage in this scenario. So
instead a two-stage trait specialization approach
is used. This approach is likely worse for
compile-times. Future work that enables
const_trait can revert back to the previous
version as outlined in the comment marked
FIXME(effects).
2024-06-16 17:17:36 +02:00
joboet cf9510cd33
std: move sys_common::backtrace to sys 2024-06-16 13:14:01 +02:00
Lzu Tao 06aee7ee03 use rustc-dep-of-std in panic_unwind
Wihout it, std keeps rebuiling when unchanged.
But we could use `--keep-stage=1` to make it not rebuild.
2024-06-16 09:38:30 +00:00
Jacob Pratt 623cf23621
Rollup merge of #126539 - lukaslueg:patch-1, r=jhpratt
Update `Arc::try_unwrap()` docs

Clarify the language wrt "race condition" not meaning "memory unsafety".

The docs make an important point about a 'logical' race condition that can occur if the `Err`-case in `Arc::try_unwrap()` is not handled properly. The language as is uses the term "race condition", which the reader may associate with "memory unsafety". This PR tries to clarify the scenario and qualify "race condition without memory unsafety".
2024-06-16 03:41:58 -04:00
Jacob Pratt e4bc7deb78
Rollup merge of #125112 - tbu-:pr_create_dir_all_empty, r=dtolnay
Document behavior of `create_dir_all` wrt. empty path

The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works.

Closes #105108 by documenting the current behavior.
2024-06-16 03:41:57 -04:00
lukaslueg 893f95f1f7
Update Arc::try_unwrap() docs
Clarify the language wrt `race condition` not meaning `memory unsafety`.
2024-06-16 09:07:08 +02:00
Lukas Bergdoll f7496f5f85 Apply review comments 2024-06-16 08:27:49 +02:00
bors cd0c944b07 Auto merge of #126299 - scottmcm:tune-sliceindex-ubchecks, r=saethlin
Remove superfluous UbChecks from `SliceIndex` methods

The current implementation calls the unsafe ones from the safe ones, but that means they end up emitting UbChecks that are impossible to hit, since we just checked those things.

This PR adds some new module-local helpers for the code shared between them, so the safe methods can be small enough to inline by avoiding those extra checks, while the unsafe methods still help catch length mistakes.

r? `@saethlin`
2024-06-16 03:22:02 +00:00
Scott McMurray 33c4817d98 Redo SliceIndex implementations 2024-06-15 17:39:25 -07:00
Slanterns 6cce48838b
update comment 2024-06-16 06:31:37 +08:00
Guillaume Gomez 4f83c1d967
Rollup merge of #126229 - ChrisDenton:bindgen, r=Mark-Simulacrum
Bump windows-bindgen to 0.57

This PR updates our generated Windows API bindings using the latest version of `windows-bindgen`.

The only change to the generated code is that `derive` is used for `Copy` and `Clone` instead of `impl`.
2024-06-15 19:51:34 +02:00
joboet f3facf1175
std: refactor the TLS implementation
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`.

Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones:
* the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code.
* I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that

Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps.

@rustbot label +A-thread-locals
2024-06-15 17:47:35 +02:00
bors 92af831290 Auto merge of #126518 - matthiaskrgr:rollup-wb70rzq, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #125829 (rustc_span: Add conveniences for working with span formats)
 - #126361 (Unify intrinsics body handling in StableMIR)
 - #126417 (Add `f16` and `f128` inline ASM support for `x86` and `x86-64`)
 - #126424 ( Also sort `crt-static` in `--print target-features` output)
 - #126428 (Polish `std::path::absolute` documentation.)
 - #126429 (Add `f16` and `f128` const eval for binary and unary operationations)
 - #126448 (End support for Python 3.8 in tidy)
 - #126488 (Use `std::path::absolute` in bootstrap)
 - #126511 (.mailmap: Associate both my work and my private email with me)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-15 14:51:12 +00:00
Jubilee Young b8eb6ad032 std: suggest OnceLock over Once 2024-06-15 00:09:03 -07:00
Kevin Reid 416888f05b Polish std::path::absolute documentation.
These changes bring it closer to other standard library documentation
and, in particular, `std::fs::canonicalize`, which it will often be
compared with.

* Add `# Platform-specific behavior` section, with content moved from
  Examples section.
* Create `# Errors` section.
* Phrase error description to allow future platforms to have new
  syntactic errors, rather than only emptiness.
* Add missing commas.
* Indent example code 4 spaces.
2024-06-14 13:13:27 -07:00
bors f9515fdd5a Auto merge of #126473 - matthiaskrgr:rollup-8w2xm09, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #123769 (Improve escaping of byte, byte str, and c str proc-macro literals)
 - #126054 (`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration)
 - #126135 (add HermitOS support for vectored read/write operations)
 - #126266 (Unify guarantees about the default allocator)
 - #126285 (`UniqueRc`: support allocators and `T: ?Sized`.)
 - #126399 (extend the check for LLVM build)
 - #126426 (const validation: fix ICE on dangling ZST reference)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 11:29:58 +00:00
Matthias Krüger b55cabe636
Rollup merge of #126285 - kpreid:unique-rc, r=dtolnay
`UniqueRc`: support allocators and `T: ?Sized`.

Added the following (all unstable):

* Defaulted type pararameter `A: Allocator`.
* `UniqueRc::new_in()`.
* `T:  ?Sized` where possible.
* `impl CoerceUnsized for UniqueRc`.

These changes are motivated by supporting the implementation of unsized `Rc::make_mut()` (PR #116113), but are also intended to be obvious generalizations of `UniqueRc` to support the things `Rc` does.

r? ``````@the8472``````
2024-06-14 12:23:37 +02:00
Matthias Krüger e923048768
Rollup merge of #126266 - tbu-:pr_doc_alloc_default_system, r=jhpratt
Unify guarantees about the default allocator

`std::alloc` said that the default allocator is unspecified for all crrate types except `cdylib` and `staticlib`. Adjust `std::alloc::System` documentation to say the same.

Fixes #125870.
2024-06-14 12:23:37 +02:00
Matthias Krüger 6396d4c846
Rollup merge of #126135 - hermit-os:fuse, r=jhpratt
add HermitOS support for vectored read/write operations

In general, the I/O interface of hermit-abi is revised and now a more POSIX-like interface. Consequently, platform abstraction layer for HermitOS has slightly adjusted and some inaccuracies remove.

Hermit is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-06-14 12:23:36 +02:00
Matthias Krüger 20ca54b6a6
Rollup merge of #123769 - dtolnay:literal, r=fee1-dead
Improve escaping of byte, byte str, and c str proc-macro literals

This PR changes the behavior of `proc_macro::Literal::byte_character` (https://github.com/rust-lang/rust/issues/115268), `byte_string`, and `c_string` (https://github.com/rust-lang/rust/issues/119750) to improve their choice of escape sequences. 3 categories of changes are made:

1. Never use `\x00`. Always prefer `\0`, which is supported in all the same places.

2. Never escape `\'` inside double quotes and `\"` inside single quotes.

3. Never use `\x` for valid UTF-8 in literals that permit `\u`.

The second commit adds tests covering these cases, asserting the **old** behavior.

The third commit implements the behavior change and simultaneously updates the tests to assert the **new** behavior.
2024-06-14 12:23:35 +02:00
Ralf Jung 9e851041d7 div_euclid, rem_euclid: clarify/extend documentation 2024-06-14 11:18:59 +02:00
Matthias Krüger e1e72aa486
Rollup merge of #126351 - devnexen:to_sol11_upd, r=ChrisDenton
std::unix::fs::link using direct linkat call for Solaris.

Since we support solaris 11 as minimum, we can get rid of the runtime overhead.

try-job: dist-various-2
2024-06-14 08:35:49 +02:00
Matthias Krüger 3494ea1818
Rollup merge of #126402 - firefighterduck:fix-unsafe-precon-copy, r=Nilstrieb
Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`

A small fix in the `assert_unsafe_precondition` message for `core::ptr::copy` as described by https://github.com/rust-lang/rust/issues/126400 .

fixes #126400
2024-06-13 22:55:49 +02:00
Matthias Krüger 5de59519fb
Rollup merge of #126390 - Kriskras99:master, r=Nilstrieb
Fix wording in {checked_}next_power_of_two

Small documentation update
2024-06-13 22:55:48 +02:00
Matthias Krüger 4dd8813afd
Rollup merge of #126360 - compiler-errors:uplift-structural-traits, r=lcnr
Uplift `structural_traits.rs` into the new trait solver

Self-explanatory. I will leave some comments inline regarding design decisions.
2024-06-13 22:55:46 +02:00
Matthias Krüger a685cdc34f
Rollup merge of #123726 - jieyouxu:command-new-docs, r=Nilstrieb
Clarify `Command::new` behavior for programs with arguments

I mistakenly passed program path along arguments as the same string into `Command::new` a couple of times now. It might be useful to explicitly highlight that `Command::new` intends to accept path to a program, not path to a program plus arguments. Also nudge the user to use `Command::arg` or `Command::args` if they wish to pass arguments.
2024-06-13 22:55:44 +02:00