Commit Graph

266574 Commits

Author SHA1 Message Date
Guillaume Gomez
fe5f734e6a
Rollup merge of #130526 - eholk:pin-reborrow, r=compiler-errors
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`
2024-09-20 19:46:38 +02:00
Guillaume Gomez
bf6389f077
Rollup merge of #128209 - beetrees:no-macos-10.10, r=jieyouxu
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
2024-09-20 19:46:37 +02:00
bors
5ba6db1b64 Auto merge of #124895 - obeis:static-mut-hidden-ref, r=compiler-errors
Disallow hidden references to mutable static

Closes #123060

Tracking:
- https://github.com/rust-lang/rust/issues/123758
2024-09-20 17:25:34 +00:00
Jubilee Young
d93d2f146d miri: An error message got changed 2024-09-20 10:02:14 -07:00
Jubilee Young
325af25c94 TL note: current means target 2024-09-20 10:02:14 -07:00
Jubilee Young
28628f3743 Normalize being an annoying little compile test
The issue-112505-overflow test just extended a case of transmute-fail.rs
so simply put them in the same file.

Then we normalize away other cases of this.
2024-09-20 10:01:02 -07:00
Tim (Theemathas) Chirananthavat
ff86269368 Add Vec::as_non_null 2024-09-20 22:19:53 +07:00
lcnr
a6aeba83be update tests 2024-09-20 14:57:58 +00:00
Artyom Tetyukhin
340b38ed67
Add arm64e-apple-tvos target 2024-09-20 18:53:09 +04:00
lcnr
9613f487ae add comment 2024-09-20 14:49:03 +00:00
bors
fb46739014 Auto merge of #130615 - GuillaumeGomez:rollup-tq0ff7y, r=GuillaumeGomez
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
2024-09-20 14:41:23 +00:00
lcnr
5a219cba95 bail if there are too many non-region infer vars 2024-09-20 14:18:40 +00:00
Guillaume Gomez
55058b6c74 Add GUI tests for line numbers padding 2024-09-20 16:02:32 +02:00
Guillaume Gomez
38bf2894fe Improve paddings for code blocks line numbers 2024-09-20 16:02:32 +02:00
Guillaume Gomez
660210c4af Add GUI test to check size of additional scraped examples 2024-09-20 16:02:32 +02:00
Guillaume Gomez
9104632c4f Revert additional scraped examples height 2024-09-20 16:02:32 +02:00
Gabriel Bjørnager Jensen
bfadadf78f Address diagnostics regression for 'const_char_encode_utf8'; 2024-09-20 15:53:57 +02:00
Guillaume Gomez
b2bcdbc797
Rollup merge of #130607 - GnomedDev:remove-seekfrom-paths, r=compiler-errors
[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.
2024-09-20 15:45:47 +02:00
Guillaume Gomez
f784c5281e
Rollup merge of #130605 - clubby789:change-test, r=jieyouxu
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.
2024-09-20 15:45:46 +02:00
Guillaume Gomez
3e21426429
Rollup merge of #130585 - GuillaumeGomez:add-rustdoc-template-tidy-check, r=notriddle
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`
2024-09-20 15:45:46 +02:00
Guillaume Gomez
6a762c96ed
Rollup merge of #130566 - jieyouxu:breakup-runtest, r=compiler-errors
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)
2024-09-20 15:45:45 +02:00
Guillaume Gomez
9cbb1cb07c
Rollup merge of #129755 - vincenzopalazzo:macros/recursive-macros-between-edition, r=compiler-errors
test: cross-edition metavar fragment specifiers

There's a subtle interaction between macros with metavar expressions and the edition-dependent fragment matching behavior. This test illustrates the current behavior when using macro-generating-macros across crate boundaries with different editions.

See the original suggestion https://github.com/rust-lang/rust/pull/123865#discussion_r1577176199

Tracking:

- https://github.com/rust-lang/rust/issues/123742
2024-09-20 15:45:45 +02:00
Guillaume Gomez
5c60185c53
Rollup merge of #129542 - zachs18:cow-self-test, r=compiler-errors
Add regression test for #129541

(maybe?) closes #129541 by adding a test that the code in question continues to compile.
2024-09-20 15:45:44 +02:00
Gurinder Singh
716044751b Add recursion limit to FFI safety lint
Fixes stack overflow in the case of recursive types
2024-09-20 18:57:59 +05:30
bors
1a5a2240bc Auto merge of #130506 - nnethercote:rustc_codegen_llvm-cleanups, r=jieyouxu
`rustc_codegen_llvm` cleanups

Some improvements I found while reading through this crate's code.

r? `@michaelwoerister`
2024-09-20 11:55:32 +00:00
GnomedDev
98e68e5040
[Clippy] Remove final std paths for diagnostic item 2024-09-20 10:39:31 +01:00
clubby789
e9fcb7db4d Fix feature name in test 2024-09-20 09:18:47 +00:00
bors
2b11f265b6 Auto merge of #130508 - adwinwhite:niche-not-depend-on-order, r=the8472
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`
2024-09-20 08:43:57 +00:00
bors
976487c48b Auto merge of #130597 - matthiaskrgr:rollup-9ls4066, r=matthiaskrgr
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
2024-09-20 06:03:19 +00:00
Matthias Krüger
ee4afa39a2
Rollup merge of #130582 - notriddle:notriddle/doctest-span, r=GuillaumeGomez
rustdoc: use the correct span for doctests

Fixes #130470
2024-09-20 06:43:39 +02:00
Matthias Krüger
ee2bec0af7
Rollup merge of #130567 - jieyouxu:tool-docs-compiletest, r=Kobzol
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.
2024-09-20 06:43:39 +02:00
Matthias Krüger
b963750b6b
Rollup merge of #130485 - compiler-errors:impossible-types, r=BoxyUwU
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`
2024-09-20 06:43:38 +02:00
bors
2e45ec36c7 Auto merge of #130593 - ytmimi:sync-from-rustfmt, r=ytmimi
Sync from rustfmt

r? `@ghost`
2024-09-20 03:31:04 +00:00
Yacin Tmimi
eeda9dd070 Merge commit 'b23b69900eab1260be510b2bd8922f4b6de6cf1e' into sync-from-rustfmt 2024-09-19 21:46:44 -04:00
Jaic1
c2ccd89ce4 handle unsized consts with type str in v0 symbol mangling 2024-09-20 09:41:16 +08:00
Yacin Tmimi
b23b69900e chore: prep v1.8.0 release 2024-09-19 21:33:01 -04:00
bors
5793a9e902 Auto merge of #130561 - lukas-code:perf-normalize-env, r=compiler-errors
[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
2024-09-20 00:19:16 +00:00
Eric Holk
a18800f807
pin_ergonomics: allow reborrowing as Pin<&T> 2024-09-19 16:28:19 -07:00
Jubilee Young
65f132fd25 Bless rustc_abi::obj_size_bound tests 2024-09-19 16:23:38 -07:00
Jubilee Young
f4cb6ef8d8 Keep object-size-dependent tests failing
These tests depend on the internal logic of rustc regarding handling
very large objects. Fix them to reflect rustc_abi::obj_size_bound diffs.
2024-09-19 16:23:38 -07:00
Jubilee Young
d6383b4605 bless issue-56762.rs as huge-static.rs 2024-09-19 16:23:38 -07:00
Jubilee Young
42dbf29b48 Correct outdated object size limit
The comment here about 48 bit addresses being enough was written in 2016
but was made incorrect in 2019 by 5-level paging, and then persisted for
another 5 years before being noticed and corrected.
2024-09-19 16:23:38 -07:00
Eric Holk
92a5d21bc4
Add a test case to make sure we don't reborrow twice 2024-09-19 15:40:56 -07:00
Eric Holk
b2b76fb706
Allow shortening reborrows
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.
2024-09-19 15:34:00 -07:00
Guillaume Gomez
8745bcf99b Add tidy check for rustdoc templates to ensure the whitespace characters are all stripped 2024-09-19 23:48:13 +02:00
Michael Howell
65e432db60 rustdoc: use the correct span for doctests 2024-09-19 13:57:44 -07:00
bors
506f22b466 Auto merge of #130572 - matthiaskrgr:rollup-0q3qyg9, r=matthiaskrgr
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
2024-09-19 18:40:30 +00:00
Matthias Krüger
f715815bfb
Rollup merge of #130558 - taiki-e:s390x-atomic-128, r=cuviper
Support 128-bit atomics on s390x

Since LLVM 18 (c568927f3e), 128-bit atomics are fully supported on s390x. And the current minimum external LLVM version is now 18 (https://github.com/rust-lang/rust/pull/130487).

s390x 128-bit atomic instructions (lpq,stpq,cdsg) has been present since [the First Edition of the Principles of Operation](https://publibfp.dhe.ibm.com/epubs/pdf/dz9zr000.pdf). (LLVM's minimal supported architecture level [is z10 (the Eighth Edition of the PoP)](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/SystemZ/SystemZProcessors.td#L16-L17).)

cc https://github.com/rust-lang/rust/issues/99069

r? `@cuviper`
2024-09-19 20:37:09 +02:00
Matthias Krüger
9f0d32c638
Rollup merge of #130556 - Urgau:link_cfg_internal, r=jieyouxu
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`.
2024-09-19 20:37:08 +02:00
Matthias Krüger
553c20cc92
Rollup merge of #130554 - ShE3py:unsupported-exitcode, r=Noratrieb
`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).
2024-09-19 20:37:08 +02:00