Commit Graph

11917 Commits

Author SHA1 Message Date
Trevor Gross 526b4c9070
Rollup merge of #128036 - matthiaskrgr:ccrashes, r=jieyouxu
add more tests

r? `@jieyouxu`
2024-07-22 11:40:22 -05:00
Trevor Gross 8ee5e271ef
Rollup merge of #128008 - weiznich:fix/121521, r=lcnr
Start using `#[diagnostic::do_not_recommend]` in the standard library

This commit starts using `#[diagnostic::do_not_recommend]` in the standard library to improve some error messages. In this case we just hide a certain nightly only impl as suggested in #121521

The result in not perfect yet, but at least the `Yeet` suggestion is not shown anymore. I would consider that as a minor improvement.
2024-07-22 11:40:21 -05:00
Trevor Gross 3ba92bec0e
Rollup merge of #127820 - Oneirical:intestellar-travel, r=jieyouxu
Rewrite and rename `issue-14698`. `issue-33329` and `issue-107094` `run-make` tests to rmake or ui

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: armhf-gnu
try-job: test-various
try-job: aarch64-apple
try-job: x86_64-msvc
2024-07-22 11:40:20 -05:00
Trevor Gross 5e8e46cbd2
Rollup merge of #127506 - liushuyu:s390x-target-features, r=davidtwco
rustc_target: add known safe s390x target features

This pull request adds known safe target features for s390x (aka IBM Z systems).
Currently, these features are unstable since stabilizing the target features requires submitting proposals.

The `vector` feature was added in IBM Z13 (`arch11`), and this is a SIMD feature for the newer IBM Z systems.
The `backchain` attribute is the IBM Z way of adding frame pointers like unwinding capabilities (the "frame-pointer" switch on IBM Z and IBM POWER platforms will add _emulated_ frame pointers to the binary, which profilers can't use for unwinding the stack).

Both attributes can be applied at the LLVM module or function levels. However, the `backchain` attribute has to be enabled for all the functions in the call stack to get a successful unwind process.
2024-07-22 11:40:19 -05:00
Trevor Gross 81135a015f
Rollup merge of #125990 - tbu-:pr_unsafe_env_lint_name, r=ehuss
Rename `deprecated_safe` lint to `deprecated_safe_2024`

Create a lint group `deprecated_safe` that includes `deprecated_safe_2024`.

Addresses https://github.com/rust-lang/rust/issues/124866#issuecomment-2142814375.

r? `@ehuss`
2024-07-22 11:40:19 -05:00
Oneirical 8990df7d13 rewrite and rename issue-107094 to rmake 2024-07-22 10:12:00 -04:00
Oneirical 613a7a79e7 rewrite and rename issue-33329 to ui test 2024-07-22 10:11:59 -04:00
Oneirical e870ab86dc rewrite and rename issue-14698 to rmake 2024-07-22 10:11:47 -04:00
许杰友 Jieyou Xu (Joe) f4d6d997e3
Rollup merge of #128035 - tiif:issue-125837, r=lcnr
Add test for #125837

Fixes #125837
2024-07-22 16:44:06 +08:00
许杰友 Jieyou Xu (Joe) 5b915ab022
Rollup merge of #127985 - Oneirical:testibule-of-hell, r=Kobzol
Migrate `test-benches`, `c-unwind-abi-catch-panic` and `compiler-lookup-paths-2` `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).
2024-07-22 16:44:05 +08:00
许杰友 Jieyou Xu (Joe) c89613938d
Rollup merge of #127977 - alexcrichton:update-wasi-sdk, r=Mark-Simulacrum
Update wasi-sdk in CI to latest release

This commit updates the `wasi-sdk` download used by the `wasm32-wasi*` targets. The motivation for this commit is generally just "keep things up to date" and is not intended to cause any issues or differences from before, just a routine update.
2024-07-22 16:44:05 +08:00
Georg Semmler 00da9fc961
Start using `#[diagnostic::do_not_recommend]` in the standard library
This commit starts using `#[diagnostic::do_not_recommend]` in the
standard library to improve some error messages. In this case we just
hide a certain nightly only impl as suggested in #121521
2024-07-22 07:29:59 +02:00
bors ee0fd6caf7 Auto merge of #128048 - workingjubilee:rollup-gehtjxd, r=workingjubilee
Rollup of 6 pull requests

Successful merges:

 - #127583 (Deal with invalid UTF-8 from `gai_strerror`)
 - #128014 (Fix stab display in doc blocks)
 - #128020 (Just totally fully deny late-bound consts)
 - #128023 (rustdoc: short descriptions cause word-breaks in tables)
 - #128033 (Explain why we require `_` for empty patterns)
 - #128038 (Don't output incremental test artifacts into working directory)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-22 03:31:16 +00:00
Jubilee fdef1d9592
Rollup merge of #128038 - compiler-errors:inc-fat, r=oli-obk
Don't output incremental test artifacts into working directory

Currently tests can ICE when the test spits out `inc-fat` incremental artifacts directly into the top of the git checkout, and then the compiler version changes, and it reads nonsense incremental artifacts on a subsequent test run.

r? `@oli-obk`

cc `@Oneirical,` I think you added this -- I think the right flag to add when porting `-Cincremental` run-make tests is to use `//@ incremental` rather than manually specifying the `-Cincremental` rustflag.
2024-07-21 17:44:30 -07:00
Jubilee d484654a5e
Rollup merge of #128033 - Nadrieril:explain-empty-wildcards, r=compiler-errors
Explain why we require `_` for empty patterns

This adds a note to the "non-exhaustive patterns" diagnostic to explain why we sometimes require extra `_` patterns on empty types. This is one of the two diagnostic improvements I wanted to do before [stabilizing `min_exhaustive_patterns`](https://github.com/rust-lang/rust/pull/122792).

r? ``@compiler-errors``
2024-07-21 17:44:30 -07:00
Jubilee 2ef7699a1a
Rollup merge of #128020 - compiler-errors:nlb-no-const, r=BoxyUwU
Just totally fully deny late-bound consts

Kinda don't care about supporting this until we have where clauses on binders. They're super busted and should be reworked in due time, and they are approximately 100% useless until then 😸

Fixes #127970
Fixes #127009

r? ``@BoxyUwU``
2024-07-21 17:44:29 -07:00
Jubilee 5bd7525856
Rollup merge of #128014 - GuillaumeGomez:stab-in-doc-blocks, r=notriddle
Fix stab display in doc blocks

Went across this bug randomly:

![Screenshot from 2024-07-20 22-09-49](https://github.com/user-attachments/assets/89fdf427-b00e-4fcb-9d57-078bcb1bacd9)

With the fixed CSS:

![Screenshot from 2024-07-20 22-10-14](https://github.com/user-attachments/assets/eda9a1a6-6a12-408f-bd3a-25bb3397d163)

r? ```@notriddle```
2024-07-21 17:44:28 -07:00
bors 0f8534e79e Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr
Remove unnecessary impl sorting in queries and metadata

Removes unnecessary impl sorting because queries already return their keys in HIR definition order: https://github.com/rust-lang/rust/issues/120371#issuecomment-1926422838

r? `@cjgillot` or `@lcnr` -- unless I totally misunderstood what was being asked for here? 😆

fixes #120371
2024-07-21 22:43:47 +00:00
Michael Goulet 6a9110aa5a Don't output test artifacts into working directory 2024-07-21 13:45:55 -04:00
Matthias Krüger 5ab2e40294 add more tests 2024-07-21 17:50:57 +02:00
tiif 95f091693f Add test 2024-07-21 21:42:10 +08:00
Nadrieril 8a49d83db7 Explain why we require `_` for empty patterns 2024-07-21 15:24:27 +02:00
Guillaume Gomez 84db684f49 Update `source-code-page-code-scroll.goml` GUI test 2024-07-21 12:47:34 +02:00
Guillaume Gomez e4d701b1d3 Add regression test for stab display in doc blocks 2024-07-21 11:52:24 +02:00
bors 9629b90b3f Auto merge of #127722 - BoxyUwU:new_adt_const_params_limitations, r=compiler-errors
Forbid borrows and unsized types from being used as the type of a const generic under `adt_const_params`

Fixes #112219
Fixes #112124
Fixes #112125

### Motivation

Currently the `adt_const_params` feature allows writing `Foo<const N: [u8]>` this is entirely useless as it is not possible to write an expression which evaluates to a type that is not `Sized`. In order to actually use unsized types in const generics they are typically written as `const N: &[u8]` which *is* possible to provide a value of.

Unfortunately allowing the types of const parameters to contain references is non trivial (#120961) as it introduces a number of difficult questions about how equality of references in the type system should behave. References in the types of const generics is largely only useful for using unsized types in const generics.

This PR introduces a new feature gate `unsized_const_parameters` and moves support for `const N: [u8]` and `const N: &...` from `adt_const_params` into it. The goal here hopefully is to experiment with allowing `const N: [u8]` to work without references and then eventually completely forbid references in const generics.

Splitting this out into a new feature gate means that stabilization of `adt_const_params` does not have to resolve #120961 which is the only remaining "big" blocker for the feature. Remaining issues after this are a few ICEs and naming bikeshed for `ConstParamTy`.

### Implementation

The implementation is slightly subtle here as we would like to ensure that a stabilization of `adt_const_params` is forwards compatible with any outcome of `unsized_const_parameters`. This is inherently tricky as we do not support unstable trait implementations and we determine whether a type is valid as the type of a const parameter via a trait bound.

There are a few constraints here:
- We would like to *allow for the possibility* of adding a `Sized` supertrait to `ConstParamTy` in the event that we wind up opting to not support unsized types and instead requiring people to write the 'sized version', e.g. `const N: [u8; M]` instead of `const N: [u8]`.
- Crates should be able to enable `unsized_const_parameters` and write trait implementations of `ConstParamTy` for `!Sized` types without downstream crates that only enable `adt_const_params` being able to observe this (required for std to be able to `impl<T> ConstParamTy for [T]`

Ultimately the way this is accomplished is via having two traits (sad), `ConstParamTy` and `UnsizedConstParamTy`. Depending on whether `unsized_const_parameters` is enabled or not we change which trait is used to check whether a type is allowed to be a const parameter.

Long term (when stabilizing `UnsizedConstParamTy`) it should be possible to completely merge these traits (and derive macros), only having a single `trait ConstParamTy` and `macro ConstParamTy`.

Under `adt_const_params` it is now illegal to directly refer to `ConstParamTy` it is only used as an internal impl detail by `derive(ConstParamTy)` and checking const parameters are well formed. This is necessary in order to ensure forwards compatibility with all possible future directions for `feature(unsized_const_parameters)`.

Generally the intuition here should be that `ConstParamTy` is the stable trait that everything uses, and `UnsizedConstParamTy` is that plus unstable implementations (well, I suppose `ConstParamTy` isn't stable yet :P).
2024-07-21 05:36:21 +00:00
bors a62ac152ad Auto merge of #127715 - klensy:tests-w, r=Mark-Simulacrum
reenable some windows tests

Locally passing on `x86_64-pc-windows-msvc`, fingers crossed for `*-pc-windows-gnu`.

try-job: x86_64-msvc
try-job: x86_64-mingw
2024-07-21 03:06:32 +00:00
bors 2430c48b57 Auto merge of #128011 - matthiaskrgr:rollup-0vmf75y, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #127720 ([`macro_metavar_expr_concat`] Allow `concat` in repetitions)
 - #127734 (Windows: move BSD socket shims to netc)
 - #127752 (Ignore allocation bytes in one more mir-opt test)
 - #127839 (Fix git safe-directory path for docker images)
 - #127867 (Add `wasm32-wasip2` to `build-manifest` tool)
 - #127958 (Cleanup rmake.rs setup in compiletest)
 - #127975 (Fix trait bounds display)
 - #128005 (Remove _tls_used hack)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-21 00:39:36 +00:00
Michael Goulet 3862095bd2 Just totally fully deny late-bound consts 2024-07-20 19:45:24 -04:00
bors 5069856495 Auto merge of #127663 - Oneirical:fuzzy-testure, r=jieyouxu
Migrate 9 more very similar FFI `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).

For the tracking issue:

- return-non-c-like-enum-from-c
- pass-non-c-like-enum-to-c
- c-static-dylib
- c-static-rlib
- extern-fn-generic
- extern-fn-with-union
- lto-no-link-whole-rlib
- linkage-attr-on-static
- issue-28595
2024-07-20 19:49:49 +00:00
Matthias Krüger 17aaba70d9
Rollup merge of #127975 - GuillaumeGomez:fix-trait-bounds-display, r=notriddle
Fix trait bounds display

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

I took a simple rule: if there are more than two bounds, we display them like rustfmt.

Before this PR:

![Screenshot from 2024-07-19 17-38-59](https://github.com/user-attachments/assets/4162b57e-7ebb-48f9-a3a1-25e443c140cb)

After this PR:

![Screenshot from 2024-07-19 17-39-09](https://github.com/user-attachments/assets/a3ba22dd-5f34-45d0-ad9d-0cdf89dc509c)

r? `@notriddle`
2024-07-20 19:29:00 +02:00
Matthias Krüger ea9b1afc88
Rollup merge of #127752 - uweigand:s390x-miropt-update, r=Mark-Simulacrum
Ignore allocation bytes in one more mir-opt test

Following on PR #126502, add `rustc -Zdump-mir-exclude-alloc-bytes` to tests/mir-opt/dataflow-const-prop/aggregate_copy.rs as well to skip writing allocation bytes in MIR dumps.

Fixes #126261
2024-07-20 19:28:57 +02:00
Matthias Krüger fba6e1e64a
Rollup merge of #127720 - c410-f3r:concat-rep, r=cjgillot
[`macro_metavar_expr_concat`] Allow `concat` in repetitions

cc #127723
2024-07-20 19:28:56 +02:00
bors 73a228116a Auto merge of #127658 - compiler-errors:precise-capturing-rustdoc-cross, r=fmease
Add cross-crate precise capturing support to rustdoc

Follow-up to #127632. Fixes #127228.

r? `@fmease`

Tracking:
* https://github.com/rust-lang/rust/issues/123432
2024-07-20 11:03:35 +00:00
bors 1afc5fd042 Auto merge of #127998 - matthiaskrgr:rollup-ykp0h5r, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #123196 (Add Process support for UEFI)
 - #127556 (Replace a long inline "autoref" comment with method docs)
 - #127693 (Migrate `crate-hash-rustc-version` to `rmake`)
 - #127866 (Conditionally build `wasm-component-ld` )
 - #127918 (Safely enforce thread name requirements)
 - #127948 (fixes panic error `index out of bounds` in conflicting error)
 - #127980 (Avoid ref when using format! in compiler)
 - #127984 (Avoid ref when using format! in src)
 - #127987 (More accurate suggestion for `-> Box<dyn Trait>` or `-> impl Trait`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-20 08:27:20 +00:00
bors 41ff460889 Auto merge of #127003 - GrigorenkoPV:107975, r=SparrowLii
Add a test for #107975

The int is zero. But also not zero. This is so much fun.

This is a part of #105107.

Initially I was going to just rebase #108445, but quite a few things changed since then:
* The [mcve](https://github.com/rust-lang/rust/issues/105787#issuecomment-1750112388) used for #105787 got fixed.[^upd2]
* You can't just `a ?= b` for #107975 anymore. Now you have to `a-b ?= 0`. This is what this PR does. As an additional flex, it show that three ways of converting a pointer to its address have this issue:
  1. `as usize`
  2. `.expose_provenance()`
  3. `.addr()`
* #108425 simply got fixed. Yay.

As an aside, the naming for `addr_of!` is quite unfortunate in context of provenance APIs. Because `addr_of!` gives you a pointer, but what provenance APIs refer to as "address" is the `usize` value. Oh well.

UPD1: GitHub is incapable of parsing #107975 in the PR name, so let's add it here.

[^upd2]: UPD2: [The other mcve](https://github.com/rust-lang/rust/issues/105787#issue-1500501670) does not work anymore either, saying "this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details."
2024-07-20 06:05:18 +00:00
Matthias Krüger 89798e9064
Rollup merge of #127987 - estebank:impl-trait-sugg, r=cjgillot
More accurate suggestion for `-> Box<dyn Trait>` or `-> impl Trait`

When encountering `-> Trait`, suggest `-> Box<dyn Trait>` (instead of `-> Box<Trait>`.

If there's a single returned type within the `fn`, suggest `-> impl Trait`.
2024-07-20 07:13:46 +02:00
Matthias Krüger 767b3cb54b
Rollup merge of #127948 - surechen:fix_127915, r=compiler-errors
fixes panic error `index out of bounds` in conflicting error

fixes #127915
2024-07-20 07:13:44 +02:00
Matthias Krüger aa6ae4beca
Rollup merge of #127693 - Rejyr:migrate-crate-hash-rustc-version-rmake, r=jieyouxu
Migrate `crate-hash-rustc-version` to `rmake`

Part of #121876.

r? ``@jieyouxu``

try-job: x86_64-gnu-llvm-18
try-job: dist-x86_64-linux
2024-07-20 07:13:42 +02:00
Caio b8d4e4d1b3 Allow concat in repetitions 2024-07-19 21:00:46 -03:00
bors 9057c3ffec Auto merge of #127968 - fmease:upd-jsondocck-directive-style, r=GuillaumeGomez
Update jsondocck directives to follow ui_test-style

Context: Comment chain in #125813.
Follow-up to #126788.
Use the same temporary approach of "double parsing" until we figure out how we want to support compiletest/ui_test directive "add-ons" for child test runners like HtmlDocCk and JsonDocCk.

I didn't touch much of jsondocck because I want to refactor it some other time (for robustness, maintainability and better diagnostics; basically by following a similar design of my WIP HtmlDocCk-next, cc #125780).

r? `@GuillaumeGomez`
2024-07-19 21:07:48 +00:00
Oneirical 2192a916d4 rewrite compiler-lookup-paths-2 to rmake 2024-07-19 16:48:21 -04:00
Pavel Grigorenko 2b089147ab Add a bunch of tests for #107975 2024-07-19 23:27:42 +03:00
Esteban Küber 3ff758877f More accurate suggestion for `-> Box<dyn Trait>` or `-> impl Trait`
When encountering `-> Trait`, suggest `-> Box<dyn Trait>` (instead of `-> Box<Trait>`.

If there's a single returned type within the `fn`, suggest `-> impl Trait`.
2024-07-19 19:39:37 +00:00
Guillaume Gomez eec3c3db88 Add GUI test for trait bounds display 2024-07-19 21:31:30 +02:00
Guillaume Gomez 590c01a5c5 Reduce width to ensure that the name is wider and thus still triggering the scroll 2024-07-19 21:31:30 +02:00
bors ff4b39867e Auto merge of #127982 - matthiaskrgr:rollup-nzyvphj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #127295 (CFI: Support provided methods on traits)
 - #127814 (`C-cmse-nonsecure-call`: improved error messages)
 - #127949 (fix: explain E0120 better cover cases when its raised)
 - #127966 (Use structured suggestions for unconstrained generic parameters on impl blocks)
 - #127976 (Lazy type aliases: Diagostics: Detect bivariant ty params that are only used recursively)
 - #127978 (Avoid ref when using format! for perf)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-19 18:40:33 +00:00
Oneirical 27334943ed rewrite c-unwind-abi-catch-panic to rmake 2024-07-19 14:39:42 -04:00
Oneirical 7b19389d58 rewrite test-benches to rmake 2024-07-19 14:05:09 -04:00
Matthias Krüger 115b086850
Rollup merge of #127976 - fmease:lta-cyclic-bivariant-param-better-err, r=compiler-errors
Lazy type aliases: Diagostics: Detect bivariant ty params that are only used recursively

Follow-up to errs's #127871. Extends the logic to cover LTAs, too, not just ADTs.
This change only takes effect with the next-gen solver enabled as cycle errors like
the one we have here are fatal in the old solver. That's my explanation anyways.

r? compiler-errors
2024-07-19 20:03:58 +02:00
Matthias Krüger 3b20150b48
Rollup merge of #127814 - folkertdev:c-cmse-nonsecure-call-error-messages, r=oli-obk
`C-cmse-nonsecure-call`: improved error messages

tracking issue: #81391
issue for the error messages (partially implemented by this PR): #81347
related, in that it also deals with CMSE: https://github.com/rust-lang/rust/pull/127766

When using the `C-cmse-nonsecure-call` ABI, both the arguments and return value must be passed via registers. Previously, when violating this constraint, an ugly LLVM error would be shown. Now, the rust compiler itself will print a pretty message and link to more information.
2024-07-19 20:03:56 +02:00