Rollup of 5 pull requests
Successful merges:
- #128001 (Improve documentation for <integer>::from_str_radix)
- #130553 ([Clippy] Get rid of most `std` `match_def_path` usage, swap to diagnostic items.)
- #130554 (`pal::unsupported::process::ExitCode`: use an `u8` instead of a `bool`)
- #130556 (Mark the `link_cfg` feature as internal)
- #130558 (Support 128-bit atomics on s390x)
r? `@ghost`
`@rustbot` modify labels: rollup
Mark the `link_cfg` feature as internal
This PR marks the `link_cfg` feature as internal because it's a perme-unstable feature, only used by `core`/`std`and `unwind`.
`pal::unsupported::process::ExitCode`: use an `u8` instead of a `bool`
`ExitCode` should “represents the status code the current process can return to its parent under normal termination”, but is currently represented as a `bool` on unsupported platforms, making the `impl From<u8> for ExitCode` lossy.
Fixes#130532.
History: [IRLO thread](https://internals.rust-lang.org/t/mini-pre-rfc-redesigning-process-exitstatus/5426) (`ExitCode` as a `main` return), #48618 (initial impl), #93445 (`From<u8>` impl).
[Clippy] Get rid of most `std` `match_def_path` usage, swap to diagnostic items.
Part of https://github.com/rust-lang/rust-clippy/issues/5393.
This was going to remove all `std` paths, but `SeekFrom` has issues being cleanly replaced with a diagnostic item as the paths are for variants, which currently cannot be diagnostic items.
This also, as a last step, categories the paths to help with future path removals.
Improve documentation for <integer>::from_str_radix
Two improvements to the documentation:
- Document `-` as a valid character for signed integer destinations
- Make the documentation even more clear that extra whitespace and non-digit characters is invalid. Many other languages, e.g. c++, are very permissive in string to integer routines and simply try to consume as much as they can, ignoring the rest. This is trying to make the transition for developers who are used to the conversion semantics in these languages a bit easier.
Stabilize const `MaybeUninit::as_mut_ptr`
This PR stabilizes the following APIs as const stable as of rust `1.83`:
```rs
impl<T> MaybeUninit<T> {
pub const fn as_mut_ptr(&mut self) -> *mut T;
}
```
This is made possible by const_mut_refs being stabilized (yay).
FCP: #75251 [(comment)](https://github.com/rust-lang/rust/issues/75251#issuecomment-2356197443)
Never patterns constitute a read for unsafety
This code is otherwise unsound if we don't emit an unsafety error here. Noticed when fixing #130528, but it's totally unrelated.
r? `@Nadrieril`
Check params for unsafety in THIR
Self-explanatory. I'm not surprised this was overlooked, given the way that THIR visitors work. Perhaps we should provide a better entrypoint.
Fixes#130528
Further improve diagnostics for expressions in pattern position
Follow-up of #118625, see #121697.
```rs
fn main() {
match 'b' {
y.0.0.1.z().f()? as u32 => {},
}
}
```
Before:
```
error: expected one of `=>`, ``@`,` `if`, or `|`, found `.`
--> src/main.rs:3:10
|
3 | y.0.0.1.z().f()? as u32 => {},
| ^ expected one of `=>`, ``@`,` `if`, or `|`
```
After:
```
error: expected a pattern, found an expression
--> src/main.rs:3:9
|
3 | y.0.0.1.z().f()? as u32 => {},
| ^^^^^^^^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns
|
help: consider moving the expression to a match arm guard
|
3 | val if val == y.0.0.1.z().f()? as u32 => {},
| ~~~ +++++++++++++++++++++++++++++++++
help: consider extracting the expression into a `const`
|
2 + const VAL: /* Type */ = y.0.0.1.z().f()? as u32;
3 ~ match 'b' {
4 ~ VAL => {},
|
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
|
3 | const { y.0.0.1.z().f()? as u32 } => {},
| +++++++ +
```
---
r? fmease
`@rustbot` label +A-diagnostics +A-parser +A-patterns +C-enhancement
Rollup of 9 pull requests
Successful merges:
- #97524 (Add `Thread::{into_raw, from_raw}`)
- #127988 (Do not ICE with incorrect empty suggestion)
- #129422 (Gate `repr(Rust)` correctly on non-ADT items)
- #129934 (Win: Open dir for sync access in remove_dir_all)
- #130450 (Reduce confusion about `make_indirect_byval` by renaming it)
- #130476 (Implement ACP 429: add `Lazy{Cell,Lock}::get[_mut]` and `force_mut`)
- #130487 (Update the minimum external LLVM to 18)
- #130513 (Clarify docs for std::fs::File::write)
- #130522 ([Clippy] Swap `manual_retain` to use diagnostic items instead of paths)
r? `@ghost`
`@rustbot` modify labels: rollup