Commit graph

11068 commits

Author SHA1 Message Date
Michael Goulet 227374714f Delay a bug and mark precise_capturing as not incomplete 2024-06-17 22:35:25 -04:00
Michael Goulet 2e03130e11 Detect duplicates 2024-06-17 22:35:25 -04:00
Michael Goulet f66558d2bf Add tests for illegal use bound syntax 2024-06-17 22:35:25 -04:00
Michael Goulet b1efe1ab5d Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
Michael Goulet 68bd001c00 Make parse_seq_to_before_tokens take expected/nonexpected tokens, use in parse_precise_capturing_syntax 2024-06-17 22:35:25 -04:00
bors c2932aaf9d Auto merge of #126279 - Oneirical:you-can-run-make-but-cannot-hide, r=jieyouxu
Migrate `inaccessible-temp-dir`, `output-with-hyphens` and `issue-10971-temps-dir` `run-make` tests to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
2024-06-18 00:42:26 +00:00
bors 59e2c01c22 Auto merge of #125500 - Oneirical:bundle-them-up-why-not, r=jieyouxu
Migrate `link-arg`, `link-dedup` and `issue-26092` `run-make` tests to `rmake` format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

All of these tests check if rustc's output contains (or does not) contain certain strings. Does that mean these could be better suited to becoming UI/codegen tests?

try-job: x86_64-msvc
2024-06-17 21:32:16 +00:00
Ding Xiang Fei 0f8c3f7882
tail expression behind terminating scope 2024-06-18 04:14:43 +08:00
Oneirical dfba1b5cca rewrite separate-link-fail to rmake.rs 2024-06-17 15:59:39 -04:00
Oneirical df6d873ae8 rewrite no-builtins-lto to rmake 2024-06-17 15:18:23 -04:00
Oneirical 10db8c7bc2 rewrite separate-link to rmake.rs 2024-06-17 15:14:21 -04:00
Oneirical 6fffe848e3 rewrite native-link-modifier-linker to rmake 2024-06-17 14:45:19 -04:00
Oneirical 03f19d632a Add new test_while_readonly helper function to run-make-support 2024-06-17 14:37:49 -04:00
Matthias Krüger 3c5ff6efd3
Rollup merge of #126355 - ferrocene:hoverbear/run-make-pass-target, r=Kobzol
Pass target to some run-make tests

<!--
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>
-->

While trying to enable riscv64gc in https://github.com/rust-lang/rust/pull/125669, I noticed several tests failing in https://github.com/rust-lang/rust/actions/runs/9454116367/job/26040977376. I spoke a bit with `@pietroalbini` and he recommended this approach to resolving the issue.

This PR interacts with https://github.com/rust-lang/rust/pull/126279, and it is likely preferable that https://github.com/rust-lang/rust/pull/126279 merges and my changes in ae769f930e2510e57ed8bd379b1b2d393b2312c3 get removed from this PR.

## Testing

> [!NOTE]
> `riscv64gc-unknown-linux-gnu` is a [**Tier 2 with Host Tools** platform](https://doc.rust-lang.org/beta/rustc/platform-support.html), all tests may not necessarily pass! There is work in https://github.com/rust-lang/rust/pull/125220 which helps fix several related tests.

You can test out the renamed job:

```sh
DEPLOY=1 ./src/ci/docker/run.sh riscv64gc-gnu
```

`DEPLOY=1` helps reproduce the CI's environment and also avoids the chance of a `llvm-c/BitReader.h` error (detailed in https://github.com/rust-lang/rust/issues/85424 and https://github.com/rust-lang/rust/issues/56650).

<details>

<summary>tests/run-make/inaccessible-temp-dir failure</summary>

```bash
---- [run-make] tests/run-make/inaccessible-temp-dir stdout ----
# ...
  --- stdout -------------------------------
  # Create an inaccessible directory
  mkdir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/inaccessible
  chmod 000 /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/inaccessible
  # Run rustc with `-Ztemps-dir` set to a directory
  # *inside* the inaccessible one, so that it can't create it
  LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir  -Ainternal_features -Clinker='riscv64-linux-gnu-gcc' program.rs -Ztemps-dir=/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/inaccessible/tmp 2>&1 \
  	| "/checkout/src/etc/cat-and-grep.sh" 'failed to find or create the directory specified by `--temps-dir`'
  [[[ begin stdout ]]]
  error: linking with `riscv64-linux-gnu-gcc` failed: exit status: 1
    |
    = note: LC_ALL="C" PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "riscv64-linux-gnu-gcc" "-m64" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/rustcHHUPmd/symbols.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/inaccessible/tmp/program.program.45572bc5f2b14090-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/inaccessible/tmp/program.dv9uftjrq86w5xa7l2eo7g9l7.rcgu.o" "-Wl,--as-needed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e6e3c30ae61f5a31.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4f01f359c61a0a5e.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-02c7b58963139ffd.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b66d5aea60ed3c58.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-5208f104036103e4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fdc5183e4f6dcbdd.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-eab0987d4aea0945.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-7ef07c8021adbf53.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-35ca031413717e66.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-9bf8f545a9224c8a.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-d6c6aeb7f3b89252.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-80de6049595b0062.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-49619208c34115e6.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-b4719719d9691028.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-279763368bc9fa45.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-86a2a7591afd1d37.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-d0bf37205fb9f76a.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-70719e8645e6f000.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-97c640fd5e54ed4c.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/inaccessible-temp-dir/inaccessible-temp-dir/program" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
    = note: riscv64-linux-gnu-gcc: error: unrecognized command-line option '-m64'

  error: aborting due to 1 previous error

  [[[ end stdout ]]]
  Error: cannot match: failed to find or create the directory specified by `--temps-dir`
  ------------------------------------------
  --- stderr -------------------------------
  make: *** [Makefile:26: all] Error 1
  ------------------------------------------
```

</details>

<details>

<summary>tests/run-make/issue-47551 failure</summary>

```bash
---- [run-make] tests/run-make/issue-47551 stdout ----
# ...
  --- stdout -------------------------------
  LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551 -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551  -Ainternal_features -Clinker='riscv64-linux-gnu-gcc' eh_frame-terminator.rs
  ------------------------------------------
  --- stderr -------------------------------
  error: linking with `riscv64-linux-gnu-gcc` failed: exit status: 1
    |
    = note: LC_ALL="C" PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" VSLANG="1033" "riscv64-linux-gnu-gcc" "-m64" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551/rustcL9WAHK/symbols.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551/eh_frame-terminator.eh_frame_terminator.de96000750278472-cgu.0.rcgu.o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551/eh_frame-terminator.11u7alf4d09fd9gei30vk4yzn.rcgu.o" "-Wl,--as-needed" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-e6e3c30ae61f5a31.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-4f01f359c61a0a5e.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-02c7b58963139ffd.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-b66d5aea60ed3c58.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-5208f104036103e4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-fdc5183e4f6dcbdd.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-eab0987d4aea0945.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-7ef07c8021adbf53.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-35ca031413717e66.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-9bf8f545a9224c8a.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-d6c6aeb7f3b89252.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-80de6049595b0062.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-49619208c34115e6.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-b4719719d9691028.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-279763368bc9fa45.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-86a2a7591afd1d37.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-d0bf37205fb9f76a.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-70719e8645e6f000.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-97c640fd5e54ed4c.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make/issue-47551/issue-47551/eh_frame-terminator" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
    = note: riscv64-linux-gnu-gcc: error: unrecognized command-line option '-m64'

  error: aborting due to 1 previous error

  make: *** [Makefile:7: all] Error 1
  ------------------------------------------

  failures:
      [run-make] tests/run-make/inaccessible-temp-dir
      [run-make] tests/run-make/issue-47551

  test result: FAILED. 151 passed; 2 failed; 201 ignored; 0 measured; 0 filtered out; finished in 59.77s

  Some tests failed in compiletest suite=run-make mode=run-make host=x86_64-unknown-linux-gnu target=riscv64gc-unknown-linux-gnu
  Build completed unsuccessfully in 1:03:01
    local time: Mon Jun 10 20:20:39 UTC 2024
    network time: Mon, 10 Jun 2024 20:20:39 GMT
</details>

try-job: riscv64gc-gnu
2024-06-17 20:34:50 +02:00
Oneirical 6228b3e40e Rewrite and rename issue-26092 to rmake 2024-06-17 13:51:52 -04:00
Oneirical cdfcc9442e rewrite incremental-session-fail to rmake 2024-06-17 13:01:15 -04:00
Oneirical 5f44f9511d rewrite link-dedup to rmake 2024-06-17 10:43:44 -04:00
Oneirical 553204d26d Rewrite link-arg in rmake.rs 2024-06-17 10:43:44 -04:00
bors 11380368dc Auto merge of #126593 - matthiaskrgr:rollup-a5jfg7w, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #126568 (mark undetermined if target binding in current ns is not got)
 - #126577 (const_refs_to_static test and cleanup)
 - #126584 (Do not ICE in privacy when type inference fails.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-17 14:22:10 +00:00
Matthias Krüger 592f9aa544
Rollup merge of #126584 - cjgillot:issue-122736, r=michaelwoerister
Do not ICE in privacy when type inference fails.

Fixes https://github.com/rust-lang/rust/issues/122736
2024-06-17 15:43:33 +02:00
Matthias Krüger c768d6e57c
Rollup merge of #126577 - oli-obk:static_valtrees, r=RalfJung
const_refs_to_static test and cleanup

r? ``@RalfJung``

test the existing behaviour of adt_const_params combined with const_refs_to_static.

also remove a dead error variant about consts referring to statics
2024-06-17 15:43:33 +02:00
Matthias Krüger ba26af3e83
Rollup merge of #126568 - bvanjoi:fix-126376, r=petrochenkov
mark undetermined if target binding in current ns is not got

Fixes #126376
Fixes #126389

Add a branch to handle more cases...

r? `@petrochenkov`
2024-06-17 15:43:32 +02:00
bors 9b584a6f6f Auto merge of #126128 - oli-obk:method_ice, r=lcnr
Consistently use subtyping in method resolution

fixes #126062

An earlier version of this PR modified how we compute variance, but the root cause was an inconsistency between the usage of `eq` and `sub`, where we assumed that the latter passing implies the former will pass.

r? `@compiler-errors`
2024-06-17 12:08:17 +00:00
Zalathar abc2c702af coverage: Add debugging flag -Zcoverage-options=no-mir-spans
When set, this flag skips the code that normally extracts coverage spans from
MIR statements and terminators. That sometimes makes it easier to debug branch
coverage and MC/DC coverage, because the coverage output is less noisy.

For internal debugging only. If other code changes would make it hard to keep
supporting this flag, remove it.
2024-06-17 21:16:15 +10:00
Oli Scherer 3e6e6b190d Remove windows-specific copy of test 2024-06-17 10:57:52 +00:00
Oli Scherer 94f549502f Use subtyping instead of equality, since method resolution also uses subtyping 2024-06-17 10:57:52 +00:00
Oli Scherer 97372c8c88 Add regression test 2024-06-17 10:55:42 +00:00
Camille GILLOT 9074427c69 Do not ICE in privacy when type inference fails. 2024-06-17 10:09:27 +00:00
Guillaume Gomez 9092ffb7d8
Rollup merge of #126580 - GuillaumeGomez:add-missing-annotation, r=bjorn3
Add `run-make/const_fn_mir` missing test annotation

Fixes comment from https://github.com/rust-lang/rust/pull/126270.

r? `@bjorn3`
2024-06-17 11:28:54 +02:00
Guillaume Gomez 020c07718f
Rollup merge of #126570 - nnethercote:fix-126385, r=lcnr
Convert a `span_bug` to a `span_delayed_bug`.

PR #121208 converted this from a `span_delayed_bug` to a `span_bug` because nothing in the test suite caused execution to hit this path. But now fuzzing has found a test case that does hit it. So this commit converts it back to `span_delayed_bug` and adds the relevant test.

Fixes #126385.

r? `@lcnr`
2024-06-17 11:28:54 +02:00
Guillaume Gomez 9f5e2e314c
Rollup merge of #126226 - gurry:125325-improve-closure-arg-sugg, r=oli-obk
Make suggestion to change `Fn` to `FnMut` work with methods as well

Fixes #125325

The issue occurred because the code that emitted the suggestion to change `Fn` to `FnMut` worked only for function calls  and not method calls. This PR makes it work with methods as well.
2024-06-17 11:28:53 +02:00
Guillaume Gomez 20d6485e94 Add missing test annotation 2024-06-17 11:15:59 +02:00
Nicholas Nethercote bd32c4c21e Convert a span_bug to a span_delayed_bug.
PR #121208 converted this from a `span_delayed_bug` to a `span_bug`
because nothing in the test suite caused execution to hit this path. But
now fuzzing has found a test case that does hit it. So this commit
converts it back to `span_delayed_bug` and adds the relevant test.

Fixes #126385.
2024-06-17 15:21:07 +10: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) 23b936f981
Rollup merge of #125258 - compiler-errors:static-if-no-lt, r=nnethercote
Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope

Implements the change to elided lifetime resolution in *associated consts* subject to FCP here: https://github.com/rust-lang/rust/issues/125190#issue-2301532282

Specifically, walk the enclosing lifetime ribs in an associated const, and if we find no other lifetimes, then resolve to `'static`.

Also make it work for traits, but don't lint -- just give a hard error in that case.
2024-06-17 04:53:54 +01:00
bohan 2f17535584 mark undetermined if target binding in current ns is not got 2024-06-17 11:29:43 +08:00
Guillaume Gomez 5b49b68f30 Migrate run-make/used to rmake.rs 2024-06-17 00:23:28 +02:00
许杰友 Jieyou Xu (Joe) b3da6be53b
Rollup merge of #126560 - matthiaskrgr:morecrashes, r=jieyouxu
more ice tests

r? `@jieyouxu`
2024-06-16 21:14:43 +01:00
许杰友 Jieyou Xu (Joe) 1af0e6e0c3
Rollup merge of #126365 - Dirbaio:collapse-debuginfo-statics, r=workingjubilee
Honor collapse_debuginfo for statics.

fixes #126363

<!--
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-16 21:14:41 +01:00
许杰友 Jieyou Xu (Joe) a033dab05d
Rollup merge of #126192 - bjorn3:redox_patches, r=petrochenkov
Various Redox OS fixes and add i686 Redox OS target

All of these come from the fork used by Redox OS available at https://gitlab.redox-os.org/redox-os/rust/-/commits/redox-2024-05-11/?ref_type=heads.

cc `@jackpot51`
2024-06-16 21:14:40 +01:00
Matthias Krüger ff096f83f7 more ice tests 2024-06-16 20:38:08 +02:00
Nadrieril 7b764be9f1 Expand or-candidates mixed with candidates above
We can't mix them with candidates below them, but we can mix them with
candidates above.
2024-06-16 18:39:50 +02:00
Nadrieril 6b84d7566e Add tests 2024-06-16 18:23:48 +02:00
bjorn3 efa213afad Add i686-unknown-redox target
Co-Authored-By: Jeremy Soller <jackpot51@gmail.com>
2024-06-16 12:56:48 +00:00
bors f6236f63d2 Auto merge of #126542 - GuillaumeGomez:migrate-run-make-duplicate-output-flavors, r=Kobzol
Migrate `run-make/duplicate-output-flavors` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-16 12:34:44 +00:00
Guillaume Gomez ac751b3049 Migrate run-make/duplicate-output-flavors to rmake.rs 2024-06-16 11:46:02 +02:00
Slanterns 51d9546416
Apply suggestion.
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-06-16 17:19:25 +08:00
Jacob Pratt 936d76009b
Rollup merge of #126127 - Alexendoo:other-trait-diag, r=pnkfelix
Spell out other trait diagnostic

I recently saw somebody confused about the diagnostic thinking it was suggesting to add an `as` cast. This change is longer but I think it's clearer
2024-06-16 03:41:57 -04: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 240478383b
add codegen test for Error::provide 2024-06-16 07:43:08 +08:00
Guillaume Gomez f788ea47f9
Rollup merge of #126526 - Enselic:non-snake-case, r=jieyouxu
tests/ui/lint: Move 19 tests to new `non-snake-case` subdir

Mainly so that it is easier to only run all `non_snake_case`-lint-specific tests with:

    ./x test tests/ui/lint/non-snake-case

But also to reduce the size of the large `tests/ui/lint` directory. And rename some tests to pass tidy, and remove them from `src/tools/tidy/src/issues.txt`.
2024-06-15 19:51:38 +02:00
Guillaume Gomez 38b3c9acd4
Rollup merge of #126517 - GuillaumeGomez:migrate-run-make-dep-graph, r=Kobzol
Migrate `run-make/dep-graph` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-15 19:51:37 +02:00
Guillaume Gomez 1f076c273b
Rollup merge of #126478 - GuillaumeGomez:migrate-run-make-codegen-options-parsing, r=jieyouxu
Migrate `run-make/codegen-options-parsing` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? `@jieyouxu`
2024-06-15 19:51:36 +02:00
Guillaume Gomez be1d42776d
Rollup merge of #126410 - RalfJung:smir-const-operand, r=oli-obk
smir: merge identical Constant and ConstOperand types

The first commit renames the const operand visitor functions on regular MIR to match the type name, that was forgotten in the original rename.

The second commit changes stable MIR, fixing https://github.com/rust-lang/project-stable-mir/issues/71. Previously there were two different smir types for the MIR type `ConstOperand`, one used in `Operand` and one in `VarDebugInfoContents`.

Maybe we should have done this with https://github.com/rust-lang/rust/pull/125967, so there's only a single breaking change... but I saw that PR too late.

Fixes https://github.com/rust-lang/project-stable-mir/issues/71
2024-06-15 19:51:35 +02:00
Guillaume Gomez 709d862308
Rollup merge of #126404 - compiler-errors:alias-relate-terms, r=lcnr
Check that alias-relate terms are WF if reporting an error in alias-relate

Check that each of the left/right term is WF when deriving a best error obligation for an alias-relate goal. This will make sure that given `<i32 as NotImplemented>::Assoc = ()` will drill down into `i32: NotImplemented` since we currently treat the projection as rigid.

r? lcnr
2024-06-15 19:51:35 +02:00
Martin Nordholts b717aa1b95 tests/ui/lint: Move 19 tests to new non-snake-case subdir
Mainly so that it is easier to only run all `non-snake-case`-specific
tests but no other tests with:

    ./x test tests/ui/lint/non-snake-case

But also to reduce the size of the large `tests/ui/lint` directory. And
rename some tests to pass tidy, and remove them from
`src/tools/tidy/src/issues.txt`.
2024-06-15 18:18:43 +02:00
Guillaume Gomez a4eaf87982 Migrate run-make/dep-graph to rmake.rs 2024-06-15 17:34:43 +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
Matthias Krüger 3775f2f5d0
Rollup merge of #126429 - tgross35:f16-f128-const-eval, r=RalfJung
Add `f16` and `f128` const eval for binary and unary operationations

Add const evaluation and Miri support for f16 and f128, including unary and binary operations. Casts are not yet included.

Fixes https://github.com/rust-lang/rust/issues/124583

r? ``@RalfJung``
2024-06-15 14:40:50 +02:00
Matthias Krüger 0f2cc21547
Rollup merge of #126417 - beetrees:f16-f128-inline-asm-x86, r=Amanieu
Add `f16` and `f128` inline ASM support for `x86` and `x86-64`

This PR adds `f16` and `f128` input and output support to inline ASM on `x86` and `x86-64`. `f16` vector sizes are taken from [here](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html).

Relevant issue: #125398
Tracking issue: #116909

``@rustbot`` label +F-f16_and_f128
2024-06-15 14:40:48 +02:00
Matthias Krüger dad74aa67c
Rollup merge of #126361 - celinval:issue-0079-intrinsic, r=oli-obk
Unify intrinsics body handling in StableMIR

rust-lang/rust#120675 introduced a new mechanism to declare intrinsics which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic with `#[rustc_intrinsic_must_be_overridden]`.
In practice, this means that a backend should not generate code for the placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation, and it doesn't need to be exposed to StableMIR users.

In this PR, we unify the interface for intrinsics marked with `rustc_intrinsic_must_be_overridden` and intrinsics that do not have a body.

Fixes https://github.com/rust-lang/project-stable-mir/issues/79

r? ``@oli-obk``

cc: ``@momvart``
2024-06-15 14:40:48 +02:00
bors 687a68d679 Auto merge of #126514 - matthiaskrgr:rollup-pnwi8ns, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #126354 (Use `Variance` glob imported variants everywhere)
 - #126367 (Point out failing never obligation for `DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK`)
 - #126469 (MIR Shl/Shr: the offset can be computed with rem_euclid)
 - #126471 (Use a consistent way to filter out bounds instead of splitting it into three places)
 - #126472 (build `libcxx-version` only when it doesn't exist)
 - #126497 (delegation: Fix hygiene for `self`)
 - #126501 (make bors ignore comments in PR template)
 - #126509 (std: suggest OnceLock over Once)
 - #126512 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-15 12:38:17 +00:00
Urgau ab0e72781f Suggest standalone doctest for non-local impl defs 2024-06-15 13:00:53 +02:00
Matthias Krüger 4265043aae
Rollup merge of #126497 - petrochenkov:delehyg, r=compiler-errors
delegation: Fix hygiene for `self`

And fix diagnostics for `self` from a macro.

The missing rib caused `self` to be treated as a generic parameter and ignore `macro_rules` hygiene.

Addresses this comment https://github.com/rust-lang/rust/pull/124135#discussion_r1637492234.
2024-06-15 10:56:43 +02:00
Matthias Krüger b473ec2744
Rollup merge of #126367 - compiler-errors:point-out-failing-never-obligation, r=WaffleLapkin
Point out failing never obligation for `DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK`

Based on top of #125289, so just need to look at the last commit.

r? `@WaffleLapkin`
2024-06-15 10:56:41 +02:00
bors 1d1356d0f6 Auto merge of #125722 - Urgau:non_local_defs-macro-to-change, r=estebank
Indicate in `non_local_defs` lint that the macro needs to change

This PR adds a note to indicate that the macro needs to change in the `non_local_definitions` lint output.

Address https://github.com/rust-lang/rust/pull/125089#discussion_r1616311862
Fixes #125681
r? `@estebank`
2024-06-15 08:50:44 +00:00
Scott McMurray 17a9d3498b Add ub-checks to slice_index MIR-opt test 2024-06-14 23:18:19 -07:00
bors 3fc81daffd Auto merge of #122613 - Zalathar:profiler, r=nnethercote
Don't build a broken/untested profiler runtime on mingw targets

Context: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20build.20a.20broken.2Funtested.20profiler.20runtime.20on.20mingw.3F

#75872 added `--enable-profiler` to the `x86_64-mingw` job (to cause some additional tests to run), but had to also add `//@ ignore-windows-gnu` to all of the tests that rely on the profiler runtime actually *working*, because it's broken on that target.

We can achieve a similar outcome by going through all the `//@ needs-profiler-support` tests that don't actually need to produce/run a binary, and making them use `-Zno-profiler-runtime` instead, so that they can run even in configurations that don't have the profiler runtime available. Then we can remove `--enable-profiler` from `x86_64-mingw`, and still get the same amount of testing.

This PR also removes `--enable-profiler` from the mingw dist builds, since it is broken/untested on that target. Those builds have had that flag for a very long time.
2024-06-15 00:04:01 +00:00
Vadim Petrochenkov cbc3bdbe01 delegation: Fix hygiene for self
And fix diagnostics for `self` from a macro.
2024-06-15 00:45:05 +03:00
Jack Wrenn df1d6168f4 safe transmute: support non-ZST, variantful, uninhabited enums
Previously, `Tree::from_enum`'s implementation branched into three disjoint
cases:

 1. enums that uninhabited
 2. enums for which all but one variant is uninhabited
 3. enums with multiple inhabited variants

This branching (incorrectly) did not differentiate between variantful and
variantless uninhabited enums. In both cases, we assumed (and asserted) that
uninhabited enums are zero-sized types. This assumption is false for enums like:

    enum Uninhabited { A(!, u128) }

...which, currently, has the same size as `u128`. This faulty assumption
manifested as the ICE reported in #126460.

In this PR, we revise the first case of `Tree::from_enum` to consider only the
narrow category of "enums that are uninhabited ZSTs". These enums, whose layouts
are described with `Variants::Single { index }`, are special in their layouts
otherwise resemble the `!` type and cannot be descended into like typical enums.
This first case captures uninhabited enums like:

    enum Uninhabited { A(!, !), B(!) }

The second case is revised to consider the broader category of "enums that defer
their layout to one of their variants"; i.e., enums whose layouts are described
with `Variants::Single { index }` and that do have a variant at `index`. This
second case captures uninhabited enums that are not ZSTs, like:

    enum Uninhabited { A(!, u128) }

...which represent their variants with `Variants::Single`.

Finally, the third case is revised to cover the broader category of "enums with
multiple variants", which captures uninhabited, non-ZST enums like:

    enum Uninhabited { A(u8, !), B(!, u32) }

...which represent their variants with `Variants::Multiple`.

This PR also adds a comment requested by RalfJung in his review of #126358 to
`compiler/rustc_const_eval/src/interpret/discriminant.rs`.

Fixes #126460
2024-06-14 21:11:08 +00:00
Oneirical 5f2b47fcb6 rewrite native-link-modifier-verbatim-rustc to rmake 2024-06-14 16:45:52 -04:00
Oneirical 8ece5ce319 rewrite output-filename-overwrites-input to rmake 2024-06-14 16:21:55 -04:00
Oneirical e088edd149 rewrite output-filename-conflicts-with-directory to rmake 2024-06-14 16:01:24 -04:00
Oneirical e9ff47ff40 rewrite error-found-staticlib-instead-crate to rmake 2024-06-14 15:50:33 -04:00
Oneirical ab71510704 rewrite incremental-debugger-visualiser to rmake 2024-06-14 15:10:34 -04:00
Trevor Gross e649042316 Remove f16 const eval crash test
Const eval negation was added. This test is now covered by Miri tests,
and merged into an existing UI test.

Fixes <https://github.com/rust-lang/rust/issues/124583>
2024-06-14 12:47:42 -05:00
Oneirical a3b7c2993e rewrite extern-flag-fun to rmake 2024-06-14 13:42:42 -04:00
bors f8e5660532 Auto merge of #118958 - c410-f3r:concat-again, r=petrochenkov
Add a new concat metavar expr

Revival of #111930

Giving it another try now that #117050 was merged.

With the new rules, meta-variable expressions must be referenced with a dollar sign (`$`) and this can cause misunderstands with `$concat`.

```rust
macro_rules! foo {
    ( $bar:ident ) => {
        const ${concat(VAR, bar)}: i32 = 1;
    };
}

// Will produce `VARbar` instead of `VAR_123`
foo!(_123);
```

In other words, forgetting the dollar symbol can produce undesired outputs.

cc #29599
cc https://github.com/rust-lang/rust/issues/124225
2024-06-14 16:41:39 +00:00
Vadim Petrochenkov 22d0b1ee18 delegation: Implement glob delegation 2024-06-14 19:27:51 +03:00
Ana Hobden f3dd4b16bc
Pass target to run-make issue-47551 2024-06-14 08:08:42 -07:00
Michael Goulet 5f3357c3c6 Resolve const lifetimes to static in trait too 2024-06-14 11:05:35 -04:00
Michael Goulet 805397c16f Add more tests 2024-06-14 11:05:35 -04:00
Michael Goulet 4f97ab54c4 Resolve elided lifetimes in assoc const to static if no other lifetimes are in scope 2024-06-14 11:05:35 -04:00
Oneirical cabc982253 rewrite invalid-staticlib to rmake 2024-06-14 10:02:39 -04:00
Oneirical ff82e43ca3 rewrite and rename issue-64153 to rmake.rs 2024-06-14 10:02:39 -04:00
bors 7ac6c2fc68 Auto merge of #125347 - tesuji:needtests, r=nikic
Add codegen tests for E-needs-test

close #36010
close #68667
close #74938
close #83585
close #93036
close #109328
close #110797
close #111508
close #112509
close #113757
close #120440
close #118392
close #71096

r? nikic
2024-06-14 13:40:52 +00:00
Guillaume Gomez 267ba9ade2 Migrate run-make/codegen-options-parsing to rmake.rs 2024-06-14 13:59:44 +02: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 aebd794d15
Rollup merge of #126426 - RalfJung:dangling-zst-ice, r=oli-obk
const validation: fix ICE on dangling ZST reference

Fixes https://github.com/rust-lang/rust/issues/126393
I'm not super happy with this fix but I can't think of a better one.

r? `@oli-obk`
2024-06-14 12:23:38 +02:00
Matthias Krüger bfe032334f
Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, r=fee1-dead
`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration

Fixes #113073

This PR suggests  `impl<T: Bound> Trait<T> for Foo` when finding `impl Trait<T: Bound> for Foo`. Tangentially, it also improves a handful of other error messages.

It accomplishes this in two steps:
1. Check if constrained arguments and parameter names appear in the same order and delay emitting "incorrect number of generic arguments" error because it can be confusing for the programmer to see `0 generic arguments provided` when there are `n` constrained generic arguments.

2. Inside `E0229`, suggest declaring the type parameter right after the `impl` keyword by finding the relevant impl block's span for type parameter declaration. This also handles lifetime declarations correctly.

Also, the multi part suggestion doesn't use the fluent error mechanism because translating all the errors to fluent style feels outside the scope of this PR. I will handle it in a separate PR if this gets approved.
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
bors 63491e1012 Auto merge of #126463 - matthiaskrgr:rollup-lnkfibf, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #124884 (place explicit lifetime bound after generic param)
 - #126343 (Remove some msys2 utils)
 - #126351 (std::unix::fs::link using direct linkat call for Solaris.)
 - #126368 (Remove some unnecessary crate dependencies.)
 - #126386 (Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 09:19:38 +00:00
Matthias Krüger edd4c97b81
Rollup merge of #126386 - GuillaumeGomez:migrate-run-make-allow-non-lint-warnings-cmdline, r=jieyouxu
Migrate `run-make/allow-non-lint-warnings-cmdline` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-06-14 08:35:50 +02:00
Matthias Krüger 74e82328ce
Rollup merge of #124884 - bvanjoi:fix-124785, r=estebank
place explicit lifetime bound after generic param

Fixes #124785

An easy fix.
2024-06-14 08:35:48 +02:00
Matthias Krüger 2b3fb62b93
Rollup merge of #126320 - oli-obk:pat_ice, r=lcnr
Avoid ICES after reporting errors on erroneous patterns

fixes #109812
fixes #125914
fixes #124004
2024-06-14 08:35:48 +02:00
Matthias Krüger 254f10a59c
Rollup merge of #126270 - GuillaumeGomez:migrate-run-make-const_fn_mir, r=jieyouxu
Migrate run make const fn mir

Part of https://github.com/rust-lang/rust/issues/121876.

r? ```@jieyouxu```
2024-06-14 08:35:47 +02:00
Matthias Krüger 0468462538
Rollup merge of #123962 - oli-obk:define_opaque_types5, r=lcnr
change method resolution to constrain hidden types instead of rejecting method candidates

Some of these are in probes and may affect inference. This is therefore a breaking change.

This allows new code to compile on stable:

```rust
trait Trait {}

impl Trait for u32 {}

struct Bar<T>(T);

impl Bar<u32> {
    fn foo(self) {}
}

fn foo(x: bool) -> Bar<impl Sized> {
    if x {
        let x = foo(false);
        x.foo();
        //^ this used to not find the `foo` method, because while we did equate `x`'s type with possible candidates, we didn't allow opaque type inference while doing so
    }
    todo!()
}
```

r? ```````@compiler-errors```````

fixes  #121404

cc https://github.com/rust-lang/rust/issues/116652
2024-06-14 08:35:46 +02:00
Ralf Jung a6907100de const validation: fix ICE on dangling ZST reference 2024-06-14 07:52:51 +02:00
Zalathar 2646db92fe Remove //@ ignore-windows-gnu from tests that need the profiler
The profiler runtime is no longer built in mingw test jobs, so these tests
should naturally be skipped by `//@ needs-profiler-support`.
2024-06-14 13:31:46 +10:00
Zalathar 5330ccdb34 Use -Zno-profiler-runtime instead of //@ needs-profiler-support
For PGO/coverage tests that don't need to build or run an actual artifact, we
can use `-Zno-profiler-runtime` to run the test even when the profiler runtime
is not available.
2024-06-14 13:31:46 +10:00
bors bfa098eae0 Auto merge of #126439 - matthiaskrgr:rollup-856xt18, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #123726 (Clarify `Command::new` behavior for programs with arguments)
 - #126088 ([1/2] clean-up / general improvements)
 - #126238 (Fix Miri sysroot for `x run`)
 - #126315 (Add pub struct with allow(dead_code) into worklist)
 - #126360 (Uplift `structural_traits.rs` into the new trait solver)
 - #126371 (Tweak output of import suggestions)
 - #126388 (const-eval: make lint scope computation consistent)
 - #126390 (Fix wording in {checked_}next_power_of_two)
 - #126392 (Small style improvement in `gvn.rs`)
 - #126402 (Fix wrong `assert_unsafe_precondition` message for `core::ptr::copy`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-14 02:44:01 +00:00
Michael Goulet fdd90db528 Point out exactly what obligation will fail 2024-06-13 21:47:43 -04:00
Caio 4b82afb40c Add a new concat metavar expr 2024-06-13 22:12:26 -03:00
Guillaume Gomez 9e466d3361 Remove failing GUI test to stop blocking CI until it is fixed 2024-06-14 00:49:05 +02:00
Matthias Krüger 422da40294
Rollup merge of #126371 - estebank:suggest-core, r=fmease
Tweak output of import suggestions

When both `std::` and `core::` items are available, only suggest the `std::` ones. We ensure that in `no_std` crates we suggest `core::` items.

Ensure that the list of items suggested to be imported are always in the order of local crate items, `std`/`core` items and finally foreign crate items.

Tweak wording of import suggestion: if there are multiple items but they are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 22:55:46 +02:00
Matthias Krüger 977c5fd419
Rollup merge of #126315 - mu001999-contrib:fix/126289, r=petrochenkov
Add pub struct with allow(dead_code) into worklist

<!--
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>
-->

Fixes #126289
2024-06-13 22:55:45 +02:00
Esteban Küber 5de8e6edfc Tweak output of import suggestions
When both `std::` and `core::` items are available, only suggest the
`std::` ones. We ensure that in `no_std` crates we suggest `core::`
items.

Ensure that the list of items suggested to be imported are always in the
order of local crate items, `std`/`core` items and finally foreign crate
items.

Tweak wording of import suggestion: if there are multiple items but they
are all of the same kind, we use the kind name and not the generic "items".

Fix #83564.
2024-06-13 20:22:21 +00:00
David Tolnay 7ddc89e893
Remove superfluous escaping from byte, byte str, and c str literals 2024-06-13 09:49:15 -07:00
David Tolnay 2cc0284905
Add more Literal::to_string tests 2024-06-13 09:39:29 -07:00
David Tolnay 57106e4a46
Rename proc_macro::Literal tests from parse.rs to literal.rs
This module contains tests not just of parse (FromStr) but also
to_string (Display) for literals.
2024-06-13 09:39:27 -07:00
beetrees dfc5514527
Add f16 and f128 inline ASM support for x86 and x86-64 2024-06-13 16:12:23 +01:00
Ralf Jung dcee529e5c smir: merge identical Constant and ConstOperand types 2024-06-13 16:11:40 +02:00
bors b6e5e3ffbb Auto merge of #125289 - WaffleLapkin:never-obligations, r=compiler-errors
Implement lint for obligations broken by never type fallback change

This is the second (and probably last major?) lint required for the never type fallback change.

The idea is to check if the code errors with `fallback = ()` and if it errors with `fallback = !` and if it went from "ok" to "error", lint.

I'm not happy with the diagnostic, ideally we'd highlight what bound is the problem. But I'm really unsure how to do that  (cc `@jackh726,` iirc you had some ideas?)

r? `@compiler-errors`

Thanks `@BoxyUwU` with helping with trait solver stuff when I was implementing the initial version of this lint.

Tracking:
- https://github.com/rust-lang/rust/issues/123748
2024-06-13 14:05:19 +00:00
Dario Nieuwenhuis b89a0a7838 Add debuginfo tests for collapse_debuginfo for statics. 2024-06-13 16:04:31 +02:00
Michael Goulet 93ee07c756 Check that alias-relate terms are WF if reporting an error in alias-relate 2024-06-13 08:52:35 -04:00
Waffle Lapkin ea98e42bfd rebase blessing 2024-06-13 14:43:16 +02:00
León Orell Valerian Liehr 3e96d58557
Rollup merge of #126366 - celinval:issue-0080-def-ty, r=oli-obk
Add a new trait to retrieve StableMir definition Ty

We implement the trait only for definitions that should have a type. It's possible that I missed a few definitions, but we can add them later if needed.

Fixes https://github.com/rust-lang/project-stable-mir/issues/80
2024-06-13 13:05:25 +02:00
Guillaume Gomez be7b587cd1 Migrate run-make/const_fn_mir to rmake.rs 2024-06-13 12:59:24 +02:00
Guillaume Gomez eca8d209d9 Make run-make/allow-non-lint-warnings-cmdline into a ui test 2024-06-13 12:55:55 +02:00
Guillaume Gomez 96f9fe5488 Migrate run-make/allow-non-lint-warnings-cmdline to rmake.rs 2024-06-13 12:55:55 +02:00
Oli Scherer 9cf60ee9d3 Method resolution constrains hidden types instead of rejecting method candidates 2024-06-13 10:41:53 +00:00
Oli Scherer c75f7283bf Add some tests 2024-06-13 10:41:52 +00:00
Waffle Lapkin 268b556393 Bless a test 2024-06-13 12:24:31 +02:00
Waffle Lapkin 83f8f9f85d Implement lint for obligations broken by never type fallback change 2024-06-13 12:24:31 +02:00
Sergio Gasquez 3954b744cc feat: Add std Xtensa targets support 2024-06-13 09:22:21 +02:00
Oli Scherer a6217011f6 Replace some Option<Diag> with Result<(), Diag> 2024-06-13 06:16:12 +00:00
Oli Scherer 2733b8ab8d Avoid follow-up errors on erroneous patterns 2024-06-13 06:14:32 +00:00
bors 56e112afb6 Auto merge of #126374 - workingjubilee:rollup-tz0utfr, r=workingjubilee
Rollup of 10 pull requests

Successful merges:

 - #125674 (Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format)
 - #125688 (Walk into alias-eq nested goals even if normalization fails)
 - #126142 (Harmonize using root or leaf obligation in trait error reporting)
 - #126303 (Urls to docs in rust_hir)
 - #126328 (Add Option::is_none_or)
 - #126337 (Add test for walking order dependent opaque type behaviour)
 - #126353 (Move `MatchAgainstFreshVars` to old solver)
 - #126356 (docs(rustc): Improve discoverable of Cargo docs)
 - #126358 (safe transmute: support `Single` enums)
 - #126362 (Make `try_from_target_usize` method public)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-13 05:00:13 +00:00
Jubilee d33ec8ed8c
Rollup merge of #126358 - jswrenn:fix-125811, r=compiler-errors
safe transmute: support `Single` enums

Previously, the implementation of `Tree::from_enum` incorrectly treated enums with `Variants::Single` and `Variants::Multiple` identically. This is incorrect for `Variants::Single` enums, which delegate their layout to that of a variant with a particular index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted to compute the tag of variants other than the one at `Variants::Single`'s `index`, and fell afoul of a sanity-checking assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`. This assertion is non-load-bearing, and can be removed; the routine its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent: calling `Tree::from_variant` on a variant that does not exist is ill-defined. A sanity check the given variant has `FieldShapes::Arbitrary` fails, and the analysis is (correctly) aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that `Tree::from_variant` is not called on variants that are, as far as layout is concerned, nonexistent. Specifically, the implementation of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the first case, `Tree::uninhabited()` is produced. In the second case, the layout is delegated to `Variants::Single`'s index.

Fixes #125811
2024-06-12 20:03:22 -07:00
Jubilee 100588ff31
Rollup merge of #126337 - oli-obk:nested_gat_opaque, r=lcnr
Add test for walking order dependent opaque type behaviour

r? ```@lcnr```

adding the test for your comment here: https://github.com/rust-lang/rust/pull/122366/files#r1521124754
2024-06-12 20:03:21 -07:00
Jubilee 25c55c51cb
Rollup merge of #126142 - compiler-errors:trait-ref-split, r=jackh726
Harmonize using root or leaf obligation in trait error reporting

When #121826 changed the error reporting to use root obligation and not the leafmost obligation, it didn't actually make sure that all the other diagnostics helper functions used the right obligation.

Specifically, when reporting similar impl candidates we are looking for impls of the root obligation, but trying to match them against the trait ref of the leaf obligation.

This does a few other miscellaneous changes. There's a lot more clean-up that could be done here, but working with this code is really grief-inducing due to how messy it has become over the years. Someone really needs to show it love. 😓

r? ``@estebank``

Fixes #126129
2024-06-12 20:03:19 -07:00
Jubilee 8719cc2579
Rollup merge of #125688 - compiler-errors:alias-reporting, r=lcnr
Walk into alias-eq nested goals even if normalization fails

Somewhat broken due to the fact that we don't handle aliases well, nor do we handle ambiguities well. Still want to put up this incremental piece, since it improves type errors for projections whose trait refs are not satisfied.

r? lcnr
2024-06-12 20:03:19 -07:00
Jubilee 1a6b1a14f9
Rollup merge of #125674 - Oneirical:another-day-another-test, r=jieyouxu
Rewrite `symlinked-extern`, `symlinked-rlib` and `symlinked-libraries` `run-make` tests in `rmake.rs` format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
2024-06-12 20:03:18 -07:00
bors f6b4b71ef1 Auto merge of #125165 - Oneirical:pgo-branch-weights, r=jieyouxu
Migrate `run-make/pgo-branch-weights` to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

This is a scary one and I expect things to break. Set as draft, because this isn't ready.

- [x] There is this comment here, which suggests the test is excluded from the testing process due to a platform specific issue? I can't see anything here that would cause this test to not run...
> // FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
// properly. Since we only have GCC on the CI ignore the test for now."

EDIT: This is specific to Windows-gnu.

- [x] The Makefile has this line:
```
ifneq (,$(findstring x86,$(TARGET)))
COMMON_FLAGS=-Clink-args=-fuse-ld=gold
```
I honestly can't tell whether this is checking if the target IS x86, or IS NOT. EDIT: It's checking if it IS x86.

- [x] I don't know why the Makefile was trying to pass an argument directly in the Makefile instead of setting that "aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc" input as a variable in the Rust program directly. I changed that, let me know if that was wrong.

- [x] Trying to rewrite `cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt` resulted in some butchery. For starters, in `tools.mk`, LLVM_FILECHECK corrects its own backslashes on Windows distributions, but there is no further mention of it, so I assume this is a preset environment variable... but is it really? Then, the command itself uses a Standard Input and a passed input file as an argument simultaneously, according to the [documentation](https://llvm.org/docs/CommandGuide/FileCheck.html#synopsis).

try-job: aarch64-gnu
2024-06-13 02:46:23 +00:00
Jack Wrenn fb662f2126 safe transmute: support Variants::Single enums
Previously, the implementation of `Tree::from_enum` incorrectly
treated enums with `Variants::Single` and `Variants::Multiple`
identically. This is incorrect for `Variants::Single` enums,
which delegate their layout to that of a variant with a particular
index (or no variant at all if the enum is empty).

This flaw manifested first as an ICE. `Tree::from_enum` attempted
to compute the tag of variants other than the one at
`Variants::Single`'s `index`, and fell afoul of a sanity-checking
assertion in `compiler/rustc_const_eval/src/interpret/discriminant.rs`.
This assertion is non-load-bearing, and can be removed; the routine
its in is well-behaved even without it.

With the assertion removed, the proximate issue becomes apparent:
calling `Tree::from_variant` on a variant that does not exist is
ill-defined. A sanity check the given variant has
`FieldShapes::Arbitrary` fails, and the analysis is (correctly)
aborted with `Err::NotYetSupported`.

This commit corrects this chain of failures by ensuring that
`Tree::from_variant` is not called on variants that are, as far as
layout is concerned, nonexistent. Specifically, the implementation
of `Tree::from_enum` is now partitioned into three cases:

  1. enums that are uninhabited
  2. enums for which all but one variant is uninhabited
  3. enums with multiple inhabited variants

`Tree::from_variant` is now only invoked in the third case. In the
first case, `Tree::uninhabited()` is produced. In the second case,
the layout is delegated to `Variants::Single`'s index.

Fixes #125811
2024-06-13 01:38:51 +00:00
Michael Goulet ae24ebe710 Rebase fallout 2024-06-12 21:17:33 -04:00
Michael Goulet 2c0348a0d8 Stop passing traitref/traitpredicate by ref 2024-06-12 20:57:24 -04:00
Michael Goulet 93d83c8f69 Bless and add ICE regression test 2024-06-12 20:57:23 -04:00
Michael Goulet c453c82de4 Harmonize use of leaf and root obligation in trait error reporting 2024-06-12 20:57:23 -04:00
Celina G. Val 6d4a825714 Add a new trait to retrieve StableMir definition Ty
We implement the trait only for definitions that should have a type.
It's possible that I missed a few definitions, but we can add them later
if needed.
2024-06-12 17:47:49 -07:00
Veera 5da1b4189e E0229: Suggest Moving Type Constraints to Type Parameter Declaration 2024-06-12 19:32:31 -04:00
Michael Goulet 44040a0670 Also passthrough for projection clauses 2024-06-12 19:10:02 -04:00
Michael Goulet b0c1474381 better error message for normalizes-to ambiguities 2024-06-12 19:03:37 -04:00
Michael Goulet 52b2c88bdf Walk into alias-eq nested goals even if normalization fails 2024-06-12 19:03:37 -04:00
Celina G. Val c8c6598f17 Unify intrinsics body handling in StableMIR
rust-lang/rust#120675 introduced a new mechanism to declare intrinsics
which will potentially replace the rust-intrinsic ABI.

The new mechanism introduces a placeholder body and mark the intrinsic
with #[rustc_intrinsic_must_be_overridden].
In practice, this means that backends should not generate code for the
placeholder, and shim the intrinsic.
The new annotation is an internal compiler implementation,
and it doesn't need to be exposed to StableMIR users.

In this PR, intrinsics marked with `rustc_intrinsic_must_be_overridden`
are handled the same way as intrinsics that do not have a body.
2024-06-12 16:01:38 -07:00
Michael Goulet 306501044e
Rollup merge of #126276 - mu001999-contrib:dead/enhance, r=fee1-dead
Detect pub structs never constructed even though they impl pub trait with assoc constants

Extend dead code analysis to impl items of pub assoc constants.

<!--
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-12 14:26:26 -04:00
Michael Goulet d25227c236
Rollup merge of #126036 - Oneirical:the-intelligent-intestor, r=jieyouxu
Migrate `run-make/short-ice` to `rmake`

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

try-job: x86_64-msvc
2024-06-12 14:26:25 -04:00
Michael Goulet 88984fe748
Rollup merge of #126019 - tbu-:pr_unsafe_env_fixme, r=fee1-dead
Add TODO comment to unsafe env modification

Addresses https://github.com/rust-lang/rust/pull/124636#issuecomment-2132119534.

I think that the diff display regresses a little, because it's no longer showing the `+` to show where the `unsafe {}` is added. I think it's still fine.

Tracking:
- https://github.com/rust-lang/rust/issues/124866

r? `@RalfJung`
2024-06-12 14:26:24 -04:00
Michael Goulet 7133257d4f
Rollup merge of #125869 - alexcrichton:add-p1-to-wasi-targets, r=wesleywiser
Add `target_env = "p1"` to the `wasm32-wasip1` target

This commit sets the `target_env` key for the
`wasm32-wasi{,p1,p1-threads}` targets to the string `"p1"`. This mirrors how the `wasm32-wasip2` target has `target_env = "p2"`. The intention of this is to more easily detect each target in downstream crates to enable adding custom code per-target.

cc #125803

<!--
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-12 14:26:24 -04:00