mark some panicking methods around Duration as track_caller
Currently when they panic it looks like this
```
0.005045 ---- instant_checked_duration_since_nopanic stdout ----
0.000039
0.000009 thread 'instant_checked_duration_since_nopanic' (2) panicked at /home/runner/work/miri-test-libstd/miri-test-libstd/rust-src-patched/library/std/src/time.rs:445:33:
0.000007 overflow when subtracting duration from instant
0.000006 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
0.000007 note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
```
That's pretty useless.
Also fix the panic message while we are at it.
error on empty `export_name`
fixes https://github.com/rust-lang/rust/issues/155495
Using an empty string as the name makes LLVM make up a name. However this name can be inconsistent between compilation units, which is UB and can cause linking errors, and some parts of LLVM just crash on the empty name (see the linked issue).
As far as we know there is only one valid pattern that could use this, a `#[used]` static that is not referenced by the program at all. That is not UB, but the `export_name` is not required for that to work, just normal rust name mangling would do fine.
Technically this is a breaking change, but it seems unlikely that this actually breaks code in the wild that wasn't already broken. I'll leave it up to T-lang to determine what is required here (crater run, FCW, ...), but my gut feeling is that we could just merge this and nobody would notice.
Change `SwitchInt` handling in dataflow analysis.
We call `get_switch_int_data` once for the switch and then pass that data to `apply_switch_int_edge_effect` for each switch target.
The only case in practice is `MaybePlacesSwitchIntData` which does an awkward thing, maintaining an index into the discriminants and updating it on each call to `apply_switch_int_edge_effect`.
This commit changes things to do more work up front in `get_switch_int_data`, in order to then do less work in `apply_switch_int_edge_effect`. This avoids the need for the `variants` and `next_discr` methods and the discriminants index. Overall it's a little simpler.
r? @cjgillot
Add mention of sendfile(2) and splice(2) to fs::copy() documentation.
Fixesrust-lang/rust#155968 by adding mention of sendfile(2) and splice(2) from io::copy()
Add `str::word_to_titlecase()` to `alloc`
A small addition to https://github.com/rust-lang/rust/issues/153892.
Hasn't gone through ACP, so needs libs-API signoff.
@rustbot label A-Unicode T-libs-api
Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint
This is an extension to rust-lang/rust#147382.
With this PR `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` considered as must use iif `T` must be used.
For such cases the lint will mention that `T` is wrapped in a `Result`/`ControlFlow` with an uninhabited error/break.
The reasoning here is that `Result<T, Uninhabited>` is equivalent to `T` in which values can be represented and thus the must-used-ness should also be equivalent.
Fixes https://github.com/rust-lang/rust/issues/65861
`BufWriter`: Make the soundness of `BorrowedBuf` usage clearer.
The previous safety comment was outdated as it was written before `BorrowedBuf::set_init` was changed to be a boolean. It also failed to address the possibility that `flush_buf` invalidated the assumption.
fix: Guard SizeSkeleton::compute against stack overflow
Fixesrust-lang/rust#156137
Fix: extract the recursion into a private `compute_inner` that carries a depth counter. When depth exceeds the crate's recursion limit, return `LayoutError::Unknown` and let the existing transmute size-check produce a normal error instead of crashing.
A regression test is included in `tests/ui/transmute/`.
Update example code of `std::array::from_fn`
Since the std::array::from_fn feature has been stabilized since version 1.91.1, the comment stating that it is not stable has been removed.
Additionally, the related example code has been modified into a simple example that is easy to understand.
Closerust-lang/rust#156102