Commit Graph

278947 Commits

Author SHA1 Message Date
Michael Goulet
ea9a253ff1 Properly report error when object type param default references self 2025-01-24 04:07:10 +00:00
bors
99768c80a1 Auto merge of #135921 - matthiaskrgr:rollup-5mzn76m, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #134746 (Don't ICE in coerce when autoderef fails to structurally normalize non-WF type in new solver)
 - #135552 ([AIX] Lint on structs that have a different alignment in AIX's C ABI)
 - #135779 (CI: free disk on linux arm runner)
 - #135790 (Update windows-gnu targets to set `DebuginfoKind::DWARF`)
 - #135879 (fix outdated file path ref in llvm)
 - #135883 (Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut`)
 - #135884 (remove implied end of slice)
 - #135887 (improvements on `build_steps::test` implementation)
 - #135898 (rustdoc-json-types: Finalize dyn compatibility renaming)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-23 12:39:00 +00:00
bors
fc0094f8d4 Auto merge of #135494 - yotamofek:rustdoc-fmt-from_fn, r=fmease
Refactor `fmt::Display` impls in rustdoc

This PR does a couple of things, with the intention of cleaning up and streamlining some of the `fmt::Display` impls in rustdoc:
1. Use the unstable [`fmt::from_fn`](https://github.com/rust-lang/rust/issues/117729) instead of open-coding it.
2. ~~Replace bespoke implementations of `Itertools::format` with the method itself.~~
4. Some more minor cleanups - DRY, remove unnecessary calls to `Symbol::as_str()`, replace some `format!()` calls with lazier options

The changes are mostly cosmetic but some of them might have a slight positive effect on performance.
2025-01-23 09:30:49 +00:00
Matthias Krüger
4b3d7ef888
Rollup merge of #135898 - aDotInTheVoid:dyndoc, r=fmease
rustdoc-json-types: Finalize dyn compatibility renaming

Followup to #131595.

Part of #130852.

Inspired by #135858 (does the same thing but for the rustdoc-types docs).

r? ````@fmease````
2025-01-23 09:49:36 +01:00
Matthias Krüger
76e68ccbb6
Rollup merge of #135887 - onur-ozkan:testing-improvements, r=jieyouxu
improvements on `build_steps::test` implementation

Reviewing commits one-by-one should make it easier to understand.
2025-01-23 09:49:33 +01:00
Matthias Krüger
447824d28f
Rollup merge of #135884 - hkBst:patch-13, r=compiler-errors
remove implied end of slice
2025-01-23 09:49:31 +01:00
Matthias Krüger
d1cfd39362
Rollup merge of #135883 - GrigorenkoPV:btree_set_upper_bound_mut, r=tgross35
Remove erroneous `unsafe` in `BTreeSet::upper_bound_mut`

https://github.com/rust-lang/rust/pull/128309#discussion_r1921097773

Tracking issue: https://github.com/rust-lang/rust/issues/107540
2025-01-23 09:49:27 +01:00
Matthias Krüger
e1ee0381a0
Rollup merge of #135879 - onur-ozkan:invalid-file-path, r=jieyouxu
fix outdated file path ref in llvm

This was added years ago and is outdated today.
2025-01-23 09:49:24 +01:00
Matthias Krüger
27155e5ced
Rollup merge of #135790 - wesleywiser:update_windows_gnu_debuginfokind, r=lqd
Update windows-gnu targets to set `DebuginfoKind::DWARF`

These targets have always used DWARF debuginfo and not CodeView/PDB debuginfo like the MSVC Windows targets. However, their target definitions claim to use `DebuginfoKind::PDB` probably to ensure that we do not try to allow the use of split-DWARF debuginfo.

This does not appear to be necessary since the targets set their supported split debug info to `Off`. I've looked at all of the uses of these properties and this patch does not appear to cause any functional changes in compiler behavior. I also added UI tests to attempt to validate there is no change in the behavior of these options on stable compilers.

cc ````@mati865```` since you mentioned this in #135739
cc ````@davidtwco```` for split-dwarf
2025-01-23 09:49:22 +01:00
Matthias Krüger
a6157d3038
Rollup merge of #135779 - marcoieni:free-disk-arm-runner, r=Kobzol
CI: free disk on linux arm runner

try-job: aarch64-gnu
2025-01-23 09:49:21 +01:00
Matthias Krüger
9b40bd70de
Rollup merge of #135552 - amy-kwan:amy-kwan/reprc-struct-diagnostic-power-alignment, r=workingjubilee
[AIX] Lint on structs that have a different alignment in AIX's C ABI

This PR adds a linting diagnostic on AIX for repr(C) structs that are required to follow
the power alignment rule. A repr(C) struct needs to follow the power alignment rule if
the struct:
- Has a floating-point data type (greater than 4-bytes) as its first member, or
- The first member of the struct is an aggregate, whose recursively first member is a
   floating-point data type (greater than 4-bytes).

The power alignment rule for eligible structs is currently unimplemented, so a linting
diagnostic is produced when such a struct is encountered.
2025-01-23 09:49:19 +01:00
Matthias Krüger
73dc08d470
Rollup merge of #134746 - compiler-errors:autoderef-norm-non-wf-coerce-ice, r=lcnr
Don't ICE in coerce when autoderef fails to structurally normalize non-WF type in new solver

r? lcnr
2025-01-23 09:49:18 +01:00
bors
cf577f34c4 Auto merge of #135461 - jieyouxu:migrate-jobserver-errors, r=Noratrieb
tests: Port `jobserver-error` to rmake.rs

Part of #121876.

This PR ports `tests/run-make/jobserver-error` to rmake.rs, and is basically #128789 slightly adjusted.

The complexity involved here is mostly how to get `/dev/null/` piping to fd 3 working with std `Command`, whereas with a shell this is much easier (as is evident with the `Makefile` version).

Supersedes #128789.
This PR is co-authored with `@Oneirical` and `@coolreader18.`

try-job: aarch64-gnu
try-job: i686-gnu-1
try-job: x86_64-gnu-debug
try-job: x86_64-gnu-llvm-18-1
2025-01-23 05:31:12 +00:00
bors
3cd8fcbf87 Auto merge of #135164 - Kobzol:run-make-test-glibc-symbols, r=jieyouxu
Add test for checking used glibc symbols

This test checks that we do not use too new glibc symbols in the compiler on x64 GNU Linux, in order not to break our [glibc promises](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html).

One thing that isn't solved in the PR yet is to make sure that this test will only run on `dist` CI, more specifically on the `dist-x86_64-linux` runner, in the opt-dist post-optimization tests (it can fail elsewhere, that doesn't matter). Any suggestions on how to do that are welcome.

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

r? `@jieyouxu`
2025-01-23 01:03:32 +00:00
bors
a30f9151fe Auto merge of #135896 - matthiaskrgr:rollup-g6rv7za, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #132983 (Edit dangling pointers )
 - #135409 (Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block)
 - #135557 (Point at invalid utf-8 span on user's source code)
 - #135596 (Properly note when query stack is being cut off)
 - #135794 (Detect missing fields with default values and suggest `..`)
 - #135814 (ci: use ghcr buildkit image)
 - #135826 (Misc. `rustc_resolve` cleanups)
 - #135837 (Remove test panic from File::open)
 - #135856 (Library: Finalize dyn compatibility renaming)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-22 22:19:08 +00:00
Alona Enraght-Moony
0149c0fdd8 rustdoc-json-types: Finalize dyn compatibility renaming 2025-01-22 20:01:17 +00:00
Matthias Krüger
3962bfaeed
Rollup merge of #135856 - fmease:library-mv-obj-save-dyn-compat-ii, r=tgross35
Library: Finalize dyn compatibility renaming

Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME.

Follow-up to #130827.
Part of #130852.
2025-01-22 20:37:28 +01:00
Matthias Krüger
0bdc1015cc
Rollup merge of #135837 - ChrisDenton:trunc, r=Noratrieb
Remove test panic from File::open

Fixes #135831
2025-01-22 20:37:27 +01:00
Matthias Krüger
41885a4858
Rollup merge of #135826 - yotamofek:resolve-cleanups4, r=petrochenkov
Misc. `rustc_resolve` cleanups

Hopefully this PR should make `rustc_resolve` a bit cleaner.
Each commit here stands on its own. I tried to only include changes that are easy to review, and are a clear improvement. (but I'll be happy to revert any changes that turn out to be more controversial than I'd thought)

Best viewed with whitespace ignored 😁 (especially [these two commits](a93616acf3..ae87d005bc?diff=unified&w=1))
2025-01-22 20:37:27 +01:00
Matthias Krüger
672d2de37b
Rollup merge of #135814 - marcoieni:use-buildkit-ghcr, r=Kobzol
ci: use ghcr buildkit image
2025-01-22 20:37:26 +01:00
Matthias Krüger
3b36879203
Rollup merge of #135794 - estebank:non-exhaustive-dfv-ctor, r=jieyouxu
Detect missing fields with default values and suggest `..`

When a struct ctor use has missing fields, if all those missing fields have defaults, suggest `..`:

```
error[E0063]: missing fields `field1` and `field2` in initializer of `S`
  --> $DIR/non-exhaustive-ctor.rs:16:13
   |
LL |     let _ = S { field: () };
   |             ^ missing `field1` and `field2`
   |
help: all remaining fields have default values, you can use those values with `..`
   |
LL |     let _ = S { field: (), .. };
   |                          ++++
```
2025-01-22 20:37:26 +01:00
Matthias Krüger
5fab5429c4
Rollup merge of #135596 - compiler-errors:stack, r=oli-obk
Properly note when query stack is being cut off

cc #70953

also, i'm not certain whether we should even limit this at all. i don't see the problem with printing the full query stack, apparently it was limited b/c we used to ICE? but we're already printing the full stack to disk since #108714.

r? oli-obk
2025-01-22 20:37:25 +01:00
Matthias Krüger
b4266b0bcd
Rollup merge of #135557 - estebank:wtf8, r=fee1-dead
Point at invalid utf-8 span on user's source code

```
error: couldn't read `$DIR/not-utf8-bin-file.rs`: stream did not contain valid UTF-8
  --> $DIR/not-utf8-2.rs:6:5
   |
LL |     include!("not-utf8-bin-file.rs");
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: byte `193` is not valid utf-8
  --> $DIR/not-utf8-bin-file.rs:2:14
   |
LL |     let _ = "�|�␂!5�cc␕␂��";
   |              ^
   = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
```

When we attempt to load a Rust source code file, if there is a OS file failure we try reading the file as bytes. If that succeeds we try to turn it into UTF-8. If *that* fails, we provide additional context about *where* the file has the first invalid UTF-8 character.

Fix #76869.
2025-01-22 20:37:24 +01:00
Matthias Krüger
f875983035
Rollup merge of #135409 - Shunpoco:issue-133117-ICE-never-false-edge-start-block, r=Nadrieril
Fix ICE-133117: multiple never-pattern arm doesn't have false_edge_start_block

Fixes #133117 , and close fixes #133063 , fixes #130779

In order to fix ICE-133117, at first I needed to tackle to ICE-133063 (this fixed 130779 as well).

### ICE-133063 and ICE-130779
This ICE is caused by those steps:
1. An arm has or-pattern, and all of the sub-candidates are never-pattern
2. In that case, all sub-candidates are removed in remove_never_subcandidates(). So the arm (candidate) has no sub-candidate.
3. In the current implementation, if there is no sub-candidate, the function assigns `pre_binding_block` into the candidate ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L2002-L2004)). However, otherwise_block should be assigned to the candidate as well, because the otherwise_block is unwrapped in multiple place (like in lower_match_tree()). As a result, it causes the panic.

I simply added the same block as pre_binding_block into otherwise_block, but I'm wondering if there is a better block to assign to otherwise_block (is it ok to assign the same block into pre_binding and otherwise?)

### ICE-133117
This is caused by those steps:
1. There are two arms, both are or-pattern and each has one match-pair (in the test code, both are `(!|!)`), and the second arm has a guard.
2. In match_candidate() for the first arm, it expands the second arm’s sub-candidates as well ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1800-L1805)). As a result, the root candidate of the second arm is not evaluated/modified in match_candidate(). So a false_edge_start_block is not assigned to the candidate.
3. merge_trivial_subcandidates() is called against the candidate for the second arm. It just returns immediately because the candidate has a guard. So a flase_edge_start_block is not assigned to the candidate also in this function.
4. remove_never_subcandidates() is called against the candidate. Since all sub-candidates are never-pattern. they are removed.
5. In lower_match_tree(), since there is no sub-candidate for the candidate, the candidate itself is evaluated in visit_leave_rev ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_build/src/builder/matches/mod.rs#L1532)). Because the candidate has no false_edge_start_block, it causes the panic.

So I modified the order of if blocks in merge_trivial_subcandidates() to assign a false_edge_start_block if the candidate doesn't have.
2025-01-22 20:37:24 +01:00
Matthias Krüger
9206ba535c
Rollup merge of #132983 - Anthony-Eid:dangling-pointers-lint, r=Urgau
Edit dangling pointers

Closes: #132283
2025-01-22 20:37:23 +01:00
bors
649b995a9f Auto merge of #135893 - matthiaskrgr:rollup-2qqo647, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #133372 (Refactor dyn-compatibility error and suggestions)
 - #134396 (AIX: use align 8 for byval parameter)
 - #135156 (Make our `DIFlags` match `LLVMDIFlags` in the LLVM-C API)
 - #135816 (Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors)
 - #135823 (make UI tests that use `--test` work on panic=abort targets)
 - #135850 (Update the `wasm-component-ld` tool)
 - #135858 (rustdoc: Finalize dyn compatibility renaming)
 - #135866 (Don't pick `T: FnPtr` nested goals as the leaf goal in diagnostics for new solver)
 - #135874 (Enforce that all spans are lowered in ast lowering)
 - #135875 (Remove `Copy` bound from `enter_forall`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-01-22 19:33:19 +00:00
Michael Goulet
72fa874456 Don't ICE in coerce when autoderef fails to structurally normalize non-WF type in new solver 2025-01-22 19:13:52 +00:00
Matthias Krüger
e0b4ba3737
Rollup merge of #135875 - BoxyUwU:enter_forall_no_copy, r=lcnr
Remove `Copy` bound from `enter_forall`

idk why we ever required this, `TypeFoldable` implies `Clone`
2025-01-22 19:29:45 +01:00
Matthias Krüger
7235b1a44e
Rollup merge of #135874 - oli-obk:push-vrvyyrtyxkxm, r=compiler-errors
Enforce that all spans are lowered in ast lowering

This should ensure that incremental is used as extensively as possible. It's only a debug assertion, and only enabled when incremental is enabled (as we only lower spans to relative spans then).
2025-01-22 19:29:44 +01:00
Matthias Krüger
318466aec0
Rollup merge of #135866 - BoxyUwU:dont_pick_fnptr_nested_goals, r=lcnr
Don't pick `T: FnPtr` nested goals as the leaf goal in diagnostics for new solver

r? `@lcnr`

See `tests/ui/traits/next-solver/diagnostics/dont-pick-fnptr-bound-as-leaf.rs` for a minimized example of what code this affects the diagnostics off. The output of running nightly `-Znext-solver` on that test is the following:
```
error[E0277]: the trait bound `Foo: Trait` is not satisfied
  --> src/lib.rs:14:20
   |
14 |     requires_trait(Foo);
   |     -------------- ^^^ the trait `FnPtr` is not implemented for `Foo`
   |     |
   |     required by a bound introduced by this call
   |
note: required for `Foo` to implement `Trait`
  --> src/lib.rs:7:16
   |
7  | impl<T: FnPtr> Trait for T {}
   |         -----  ^^^^^     ^
   |         |
   |         unsatisfied trait bound introduced here
note: required by a bound in `requires_trait`
  --> src/lib.rs:11:22
   |
11 | fn requires_trait<T: Trait>(_: T) {}
   |                      ^^^^^ required by this bound in `requires_trait`
```

Part of rust-lang/trait-system-refactor-initiative#148
2025-01-22 19:29:43 +01:00
Matthias Krüger
413f87a1f8
Rollup merge of #135858 - fmease:rustdoc-mv-obj-save-dyn-compat-ii, r=GuillaumeGomez
rustdoc: Finalize dyn compatibility renaming

Update the Reference link to use the new URL fragment from https://github.com/rust-lang/reference/pull/1666 (this change has finally hit stable). Fixes a FIXME.

Follow-up to #131594.
Part of #130852.
2025-01-22 19:29:42 +01:00
Matthias Krüger
b0bb6e3474
Rollup merge of #135850 - alexcrichton:update-wasm-component-ld, r=jieyouxu
Update the `wasm-component-ld` tool

This commit updates the `wasm-component-ld` tool from 0.5.11 to 0.5.12. This pulls in a fix for the binary adapters that are included with this tool for an issue described in bytecodealliance/wasmtime#10058. Some other dependencies have additionally been updated in the meantime of `wasm-component-ld` but there should otherwise be no major changes.
2025-01-22 19:29:42 +01:00
Matthias Krüger
e4c144b779
Rollup merge of #135823 - ferrocene:ja-gh135819, r=jieyouxu
make UI tests that use `--test` work on panic=abort targets

By passing `-Zpanic_abort_test`.

fixes #135819
2025-01-22 19:29:41 +01:00
Matthias Krüger
ef0e6863c6
Rollup merge of #135816 - BoxyUwU:root_normalizes_to_goal_ice, r=lcnr
Use `structurally_normalize` instead of manual `normalizes-to` goals in alias relate errors

r? `@lcnr`

I added `structurally_normalize_term` so that code that is generic over ty or const can use the structurally normalize helpers. See `tests/ui/traits/next-solver/diagnostics/alias_relate_error_uses_structurally_normalize.rs` for a description of the reason for the (now fixed) ICEs
2025-01-22 19:29:39 +01:00
Matthias Krüger
e0d74c0667
Rollup merge of #135156 - Zalathar:debuginfo-flags, r=cuviper
Make our `DIFlags` match `LLVMDIFlags` in the LLVM-C API

In order to be able to use a mixture of LLVM-C and C++ bindings for debuginfo, our Rust-side `DIFlags` needs to have the same layout as LLVM-C's `LLVMDIFlags`, and we also need to be able to convert it to the `DIFlags` accepted by LLVM's C++ API.

Internally, LLVM converts between the two types with a simple cast. We can't necessarily rely on that always being true, and LLVM doesn't expose a conversion function, so we have two potential options:
- Convert each bit/subvalue individually
- Statically assert that doing a cast is actually fine

As long as both types do remain the same under the hood (which seems likely), the static-assert-and-cast approach is easier and faster. If the static assertions ever start failing against some future version of LLVM, we'll have to switch over to the convert-each-subvalue approach, which is a bit more error-prone.

---

Extracted from #134009, though this PR ended up choosing the static-assert-and-cast approach over the convert-each-subvalue approach.
2025-01-22 19:29:39 +01:00
Matthias Krüger
df01040860
Rollup merge of #134396 - mustartt:byval-pointer-natural-alignment, r=wesleywiser
AIX: use align 8 for byval parameter

On AIX, byval pointer arguments are aligned to 8 bytes based on the 64bit register size. For example, the C callee https://godbolt.org/z/5f4vnG6bh will expect the following argument.

```
ptr nocapture noundef readonly byval(%struct.TwoU64s) align 8 %0
```

This case is captured by `run-make/extern-fn-explicit-align`
2025-01-22 19:29:38 +01:00
Matthias Krüger
cd1f36b020
Rollup merge of #133372 - cramertj:rework-dyn-suggestions, r=fmease
Refactor dyn-compatibility error and suggestions

This CL makes a number of small changes to dyn compatibility errors:
- "object safety" has been renamed to "dyn-compatibility" throughout
- "Convert to enum" suggestions are no longer generated when there exists a type-generic impl of the trait or an impl for `dyn OtherTrait`
- Several error messages are reorganized for user readability

Additionally, the dyn compatibility error creation code has been split out into functions.

cc #132713
cc #133267

r? `@compiler-errors`
2025-01-22 19:29:37 +01:00
Taylor Cramer
d00d4dfe0d Refactor dyn-compatibility error and suggestions
This CL makes a number of small changes to dyn compatibility errors:
- "object safety" has been renamed to "dyn-compatibility" throughout
- "Convert to enum" suggestions are no longer generated when there
  exists a type-generic impl of the trait or an impl for `dyn OtherTrait`
- Several error messages are reorganized for user readability

Additionally, the dyn compatibility error creation code has been
split out into functions.

cc #132713
cc #133267
2025-01-22 09:20:57 -08:00
Amy Kwan
cd2ecc4b50 [AIX] Lint on structs that have a different alignment in AIX's C ABI 2025-01-22 12:06:16 -05:00
onur-ozkan
e3a5314e0a reduce number of prepare_cargo_test args
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-22 19:48:44 +03:00
onur-ozkan
17b2ede40d resolve clippy FIXME
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-22 19:45:52 +03:00
onur-ozkan
c568da9f16 make bootstrap self test to use bootstrap cargo
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-22 19:36:17 +03:00
Jakub Beránek
5482bbac0f
Reword comment slightly 2025-01-22 17:22:39 +01:00
Marijn Schouten
53578bdd19
remove implied end of slice 2025-01-22 16:46:40 +01:00
Pavel Grigorenko
bae2a2f3b5 Remove erroneous unsafe in BTreeSet::upper_bound_mut 2025-01-22 18:36:33 +03:00
bors
dee7d0e730 Auto merge of #134478 - compiler-errors:attr-span, r=oli-obk
Properly record metavar spans for other expansions other than TT

This properly records metavar spans for nonterminals other than tokentree. This means that we operations like `span.to(other_span)` work correctly for macros. As you can see, other diagnostics involving metavars have improved as a result.

Fixes #132908
Alternative to #133270

cc `@ehuss`
cc `@petrochenkov`
2025-01-22 14:46:41 +00:00
onur-ozkan
f0dfda124d fix outdated file path ref in llvm
This was added years ago and is outdated today.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-01-22 16:52:04 +03:00
Jakub Beránek
46ae7382a4
Use objdump instead of llvm-objdump 2025-01-22 12:47:44 +01:00
Jakub Beránek
7877883339
Run the glibc run-make test in opt-dist 2025-01-22 12:47:44 +01:00
Boxy
921c226eb6 Remove Copy bound from enter_forall 2025-01-22 11:45:09 +00:00