Begin experimental support for pin reborrowing
This commit adds basic support for reborrowing `Pin` types in argument position. At the moment it only supports reborrowing `Pin<&mut T>` as `Pin<&mut T>` by inserting a call to `Pin::as_mut()`, and only in argument position (not as the receiver in a method call).
This PR makes the following example compile:
```rust
#![feature(pin_ergonomics)]
fn foo(_: Pin<&mut Foo>) {
}
fn bar(mut x: Pin<&mut Foo>) {
foo(x);
foo(x);
}
```
Previously, you would have had to write `bar` as:
```rust
fn bar(mut x: Pin<&mut Foo>) {
foo(x.as_mut());
foo(x);
}
```
Tracking:
- #130494
r? `@compiler-errors`
Remove macOS 10.10 dynamic linker bug workaround
Rust's current minimum macOS version is 10.12, so the hack can be removed. This PR also updates the `remove_dir_all` docs to reflect that all supported macOS versions are protected against TOCTOU race conditions (the fallback implementation was already removed in #127683).
try-job: dist-x86_64-apple
try-job: dist-aarch64-apple
try-job: dist-apple-various
try-job: aarch64-apple
try-job: x86_64-apple-1
Rollup of 6 pull requests
Successful merges:
- #129542 (Add regression test for #129541)
- #129755 (test: cross-edition metavar fragment specifiers)
- #130566 (Break up compiletest `runtest.rs` into smaller helper modules)
- #130585 (Add tidy check for rustdoc templates to ensure the whitespace characters are all stripped)
- #130605 (Fix feature name in test)
- #130607 ([Clippy] Remove final std paths for diagnostic item)
r? `@ghost`
`@rustbot` modify labels: rollup
[Clippy] Remove final std paths for diagnostic item
Removes the paths to SeekFrom::Start/Current that were left in #130553.
This was split off as it involves introducing a utility to check for enum ctors, as both:
- enum variants cannot be diagnostic items
- even if they could, that wouldn't help because we need to get the enum variant ctor
While adding the `is_enum_variant_ctor`, I removed both `is_diagnostic_ctor` and `is_res_diagnostic_ctor` as they are unused and never worked due to the above bullet points.
Fix feature name in test
This is meant to test that the `box_patterns` feature isn't active due to the `cfg(FALSE)`, but uses the removed `box_syntax` feature. Fix this so it's testing what it should be.
Add tidy check for rustdoc templates to ensure the whitespace characters are all stripped
Fixes https://github.com/rust-lang/rust/issues/130559.
I'm planning to send a follow-up in case a tag at the end of a line isn't needed (if the next line starts with a jinja tag for example).
r? `@notriddle`
Break up compiletest `runtest.rs` into smaller helper modules
Previously compiletest's `runtest.rs` was a massive 4700 lines file that made reading and navigation very awkward. This PR breaks the `runtest.rs` file up into smaller helper modules, one for each test suite/mode.
> [!NOTE]
> This PR should not contain functional changes, it is intended to be mostly code motion to breakup `runtest.rs` into smaller helper modules to make it easier to digest.
>
> This PR intentionally does not neatly reorganize where all the methods on `TestCx` goes, that is intended for a follow-up PR. Some methods on `TestCx` do not need to be on `TestCx`. It also does not address a weirdness in valgrind, that is intended for a follow-up PR as well.
Part of a series of compiletest cleanups #130565.
Fixes#89475.
r? `@ghost` (I need to do a self-review pass first)
Get rid of niche selection's dependence on fields's order
Fixes#125630.
Use the optimal niche selection decided in `univariant()` rather than picking niche field manually.
r? `@the8472`
Rollup of 3 pull requests
Successful merges:
- #130485 (Do not expect infer/bound/placeholder/error in v0 symbol mangling)
- #130567 (Register tool docs for compiletest)
- #130582 (rustdoc: use the correct span for doctests)
r? `@ghost`
`@rustbot` modify labels: rollup
Register tool docs for compiletest
This PR registers tool docs for `src/tools/compiletest`, meaning that
```
$ ./x doc src/tools/compiletest
```
or
```
$ ./x doc compiletest
```
will now generate docs, like for `run-make-support`.
Fixes#130564.
Do not expect infer/bound/placeholder/error in v0 symbol mangling
Infer/bound/placeholder/error are not encounterable during codegen. Let's make sure v0 symbol mangling doesn't "accidentally" handle them.
As for aliases (namely: projections and uv consts) these may still be encounterable because of the way that we render the def paths of items. Specifically, when we have something like:
```
struct W<T>(T);
impl<T> W<T> {
fn x() {
fn y() {}
}
}
```
The path of `y` is rendered like `crate_name::W<T>:❌:y`. Specifically, since `y` doesn't inherit the generics of the impl, we use the *identity* substitutions for that impl. If the impl has any aliases, they will remain unnormalized if they're rigid.
r? `@BoxyUwU`
[perf] skip normalizing param env if it is already normalized
If the param env is already normalized after elaboration, then we can skip a bunch of expensive operations.
> [!note]
> This makes it so that outlives predicates are no longer sorted after non-outlives predicates. Surely this won't make a semantic difference.
r? ghost
Generating a call to `as_mut()` let to more restrictive borrows than
what reborrowing usually gives us. Instead, we change the desugaring to
reborrow the pin internals directly which makes things more expressive.
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.
Previously compiletest's `runtest.rs` was a massive 4700 lines file that
made reading and navigation very awkward.
This commit intentionally does not neatly reorganize where all the
methods on `TestCx` goes, that is intended for a follow-up PR.