Commit Graph

9319 Commits

Author SHA1 Message Date
Michael Goulet
89409494e3 Actually, just reuse the UNUSED_LIFETIMES lint 2024-04-09 12:15:27 -04:00
Scott McMurray
b5376ba601 Remove my scalar_copy_backend_type optimization attempt
I added this back in 111999, but I no longer think it's a good idea
- It had to get scaled back to only power-of-two things to not break a bunch of targets
- LLVM seems to be getting better at memcpy removal anyway
- Introducing vector instructions has seemed to sometimes (115515) make autovectorization worse

So this removes it from the codegen crates entirely, and instead just tries to use <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/traits/builder/trait.BuilderMethods.html#method.typed_place_copy> instead of direct `memcpy` so things will still use load/store for immediates.
2024-04-09 08:51:32 -07:00
许杰友 Jieyou Xu (Joe)
09dab389e2 tests: bless ui and rustdoc-ui tests for ICE messages 2024-04-09 13:58:52 +00:00
Guillaume Gomez
e5b2935dc1
Rollup merge of #123662 - compiler-errors:no-upvars-yet, r=oli-obk
Don't rely on upvars being assigned just because coroutine-closure kind is assigned

Previously, code relied on the implicit assumption that if a coroutine-closure's kind variable was constrained, then its upvars were also constrained. This is because we assign all of them at once at the end up upvar analysis.

However, there's another way that a coroutine-closure's kind can be constrained: from a signature hint in closure signature deduction. After #123350, we use these hints, which means the implicit assumption above no longer holds.

This PR adds the necessary checks so that we don't ICE.

r? oli-obk
2024-04-09 13:39:23 +02:00
Guillaume Gomez
cfe1faa75d
Rollup merge of #123658 - compiler-errors:stop-assuming, r=oli-obk
Stop making any assumption about the projections applied to the upvars in the `ByMoveBody` pass

So it turns out that because of subtle optimizations like [`truncate_capture_for_optimization`](ab5bda1aa7/compiler/rustc_hir_typeck/src/upvar.rs (L2351)), we simply cannot make any assumptions about the shape of the projections applied to the upvar locals in a coroutine body.

So stop doing that -- the code is resilient to such projections, so the assertion really existed only to "protect against the unknown".

r? oli-obk
Fixes #123650
2024-04-09 13:39:23 +02:00
Guillaume Gomez
b3f40e3448
Rollup merge of #123653 - Urgau:split-test-non_local_defs, r=compiler-errors
Split `non_local_definitions` lint tests in separate test files

This PR splits the giant `non_local_definitions` lint UI test in separate test files.

This change is extracted from #123594 (where it was requested https://github.com/rust-lang/rust/pull/123594#discussion_r1555261772), to ease the review of the other PR and to reduce the size of the other PR.

r? ``@compiler-errors``
2024-04-09 13:39:22 +02:00
Guillaume Gomez
2e042eabbc
Rollup merge of #123638 - fmease:rustdoc-synth-auto-yeet-item-param-env-clauses, r=GuillaumeGomez
rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv

... not just the elaborated clauses.

Fixes another regression introduced by me in #123340, oops!
Fixes https://github.com/rust-lang/rust/pull/123340#issuecomment-2034195786, cc ``@tamird.``

An earlier local iteration of branch `rustdoc-simplify-auto-trait-impl-synth` (PR #123340) contained a fix for issue #111101 before I decided to limit the scope. I must've introduced this bug when manually reverting that part of the code.

r? ``@GuillaumeGomez`` or rustdoc
2024-04-09 13:39:22 +02:00
Matthias Krüger
9ea1063a12
Rollup merge of #123655 - celinval:smir-fix-binop-ty, r=compiler-errors
Remove unimplemented!() from BinOp::ty() function

To reduce redundancy, we now internalize the BinOp instead of duplicating the `ty()` function body.
2024-04-09 06:02:24 +02:00
Matthias Krüger
7e9eaba52b
Rollup merge of #123652 - cuviper:ui-vendor, r=jieyouxu
Fix UI tests with dist-vendored dependencies

There is already a workaround in `compiletest` to deal with custom
`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`.
A similar need exists when dependencies come from the local `vendor`
directory, which distro builds often use, so now we ignore that too.

Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably
expecting a version suffix, but the vendored path doesn't include the
version. Now that matches `[\\/]hashbrown` instead.
2024-04-09 06:02:24 +02:00
Matthias Krüger
55e0668fea
Rollup merge of #123649 - maurer:kcfi-v0, r=compiler-errors
KCFI: Use legal charset in shim encoding

To separate `ReifyReason::FnPtr` from `ReifyReason::VTable`, we hyphenated the shims. Hyphens are not actually legal, but underscores are, so use those instead.

r? `@compiler-errors`
2024-04-09 06:02:24 +02:00
Matthias Krüger
727c31a797
Rollup merge of #123648 - oli-obk:pattern_types_syntax, r=compiler-errors
Avoid ICEing without the pattern_types feature gate

fixes  #123643
2024-04-09 06:02:23 +02:00
Matthias Krüger
9531606bed
Rollup merge of #123624 - GuillaumeGomez:theme-switch-tests, r=notriddle
[rustdoc] [GUI tests] Make theme switching closer to reality

Better to actually perform actions user do rather than only testing the change through local storage.

As for `browser-ui-test` update: I updated `puppeteer` version (to `0.19.4`) and fixed a bug when displaying the file if it came from an `include`.

r? `@notriddle`
2024-04-09 06:02:22 +02:00
Matthias Krüger
643dee7573
Rollup merge of #122768 - oli-obk:why_is_E0699_so_bad, r=WaffleLapkin
Use the more informative generic type inference failure error on method calls on raw pointers
2024-04-09 06:02:21 +02:00
kxxt
adec1a2e84 Convert tests/run-make/cross-lang-lto-riscv-abi to rmake 2024-04-09 05:25:51 +02:00
kxxt
f19c48e7a8 Set target-abi module flag for RISC-V targets
Fixes cross-language LTO on RISC-V targets (Fixes #121924)
2024-04-09 05:25:51 +02:00
Michael Goulet
6f96d7d012 Don't rely on upvars being assigned just because coroutine-closure kind is assigned 2024-04-08 22:43:32 -04:00
bors
59c808fcd9 Auto merge of #122387 - DianQK:re-enable-early-otherwise-branch, r=cjgillot
Re-enable the early otherwise branch optimization

Closes #95162. Fixes #119014.

This is the first part of #121397.

An invalid enum discriminant can come from anywhere. We have to check to see if all successors contain the discriminant statement. This should have a pass to hoist instructions.

r? cjgillot
2024-04-09 01:02:29 +00:00
Celina G. Val
1512d06be9 Add support to intrinsics fallback body
Before this fix, the call to `body()` would crash, since `has_body()`
would return true, but we would try to retrieve the body of an intrinsic
which is not allowed.

Instead, the `Instance::body()` function will now convert an Intrinsic
into an Item before retrieving its body.
2024-04-08 17:07:29 -07:00
Michael Goulet
54a93ab11e Actually, stop making any assumption about the projections applied to the upvar 2024-04-08 19:47:52 -04:00
Chris Denton
96b6459ba0
Use new-style directives in ui test 2024-04-09 01:19:43 +02:00
Chris Denton
f66a096607
Disallow or quote all specials in bat args 2024-04-09 01:19:08 +02:00
bors
b234e44944 Auto merge of #122077 - oli-obk:eager_opaque_checks4, r=lcnr
Pass list of defineable opaque types into canonical queries

This eliminates `DefiningAnchor::Bubble` for good and brings the old solver closer to the new one wrt cycles and nested obligations. At that point the difference between `DefiningAnchor::Bind([])` and `DefiningAnchor::Error` was academic. We only used the difference for some sanity checks, which actually had to be worked around in places, so I just removed `DefiningAnchor` entirely and just stored the list of opaques that may be defined.

fixes #108498
fixes https://github.com/rust-lang/rust/issues/116877

* [x] run crater
  - https://github.com/rust-lang/rust/pull/122077#issuecomment-2013293931
2024-04-08 23:01:50 +00:00
Celina G. Val
0a4f4a3e29 Remove unimplemented!() from BinOp::ty() function
To reduce redundancy, we now internalize the BinOp instead of
duplicating the `ty()` function body.
2024-04-08 15:47:37 -07:00
Urgau
ddc16e98e6 Split non_local_definitions lint tests in separate test files 2024-04-09 00:42:48 +02:00
Josh Stone
f7b2e37f72 Fix UI tests with dist-vendored dependencies
There is already a workaround in `compiletest` to deal with custom
`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`.
A similar need exists when dependencies come from the local `vendor`
directory, which distro builds often use, so now we ignore that too.

Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably
expecting a version suffix, but the vendored path doesn't include the
version. Now that matches `[\\/]hashbrown` instead.
2024-04-08 15:04:44 -07:00
Matthew Maurer
233d94e72f KCFI: Use legal charset in shim encoding
To separate `ReifyReason::FnPtr` from `ReifyReason::VTable`, we
hyphenated the shims. Hyphens are not actually legal, but underscores
are, so use those instead.
2024-04-08 21:21:38 +00:00
Oli Scherer
24ee9b9423 Avoid ICEing without the pattern_types feature gate 2024-04-08 21:02:13 +00:00
bors
ab5bda1aa7 Auto merge of #123645 - matthiaskrgr:rollup-yd8d7f1, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #122781 (Fix argument ABI for overaligned structs on ppc64le)
 - #123367 (Safe Transmute: Compute transmutability from `rustc_target::abi::Layout`)
 - #123518 (Fix `ByMove` coroutine-closure shim (for 2021 precise closure capturing behavior))
 - #123547 (bootstrap: remove unused pub fns)
 - #123564 (Don't emit divide-by-zero panic paths in `StepBy::len`)
 - #123578 (Restore `pred_known_to_hold_modulo_regions`)
 - #123591 (Remove unnecessary cast from `LLVMRustGetInstrProfIncrementIntrinsic`)
 - #123632 (parser: reduce visibility of unnecessary public `UnmatchedDelim`)
 - #123635 (CFI: Fix ICE in KCFI non-associated function pointers)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-08 20:31:08 +00:00
Matthias Krüger
0520200a9c
Rollup merge of #123635 - maurer:kcfi-no-assoc, r=compiler-errors
CFI: Fix ICE in KCFI non-associated function pointers

We oddly weren't testing the more usual case of casting non-methods to function pointers. The KCFI shim insertion logic would ICE on these due to asking for an irrefutable associated item if we cast a function to a function pointer without needing a traditional shim.

r? `@compiler-errors`
2024-04-08 22:06:24 +02:00
Matthias Krüger
984767e500
Rollup merge of #123578 - lqd:regression-123275, r=compiler-errors
Restore `pred_known_to_hold_modulo_regions`

As requested by `@lcnr` in https://github.com/rust-lang/rust/issues/123275#issuecomment-2031885563 this PR restores `pred_known_to_hold_modulo_regions` to fix that "unexpected unsized tail" beta regression.

This also adds the reduced repro from https://github.com/rust-lang/rust/issues/123275#issuecomment-2041222851 as a sub-optimal test is better than no test at all, and it'll also cover #108721. It still ICEs on master, even though https://github.com/phlip9/rustc-warp-ice doesn't on nightly anymore, since https://github.com/rust-lang/rust/pull/122493.

Fixes #123275.

r? `@compiler-errors` but feel free to close if you'd rather have a better test instead
cc `@wesleywiser` who had signed up to do the revert

Will need a backport if we go with this PR: `@rustbot` label +beta-nominated
2024-04-08 22:06:23 +02:00
Matthias Krüger
9570ac4d28
Rollup merge of #123564 - scottmcm:step-by-div-zero, r=joboet
Don't emit divide-by-zero panic paths in `StepBy::len`

I happened to notice today that there's actually two such calls emitted in the assembly: <https://rust.godbolt.org/z/1Wbbd3Ts6>

Since they're impossible, hopefully telling LLVM that will also help optimizations elsewhere.
2024-04-08 22:06:22 +02:00
Matthias Krüger
36d1915449
Rollup merge of #123518 - compiler-errors:by-move-fixes, r=oli-obk
Fix `ByMove` coroutine-closure shim (for 2021 precise closure capturing behavior)

This PR reworks the way that we perform the `ByMove` coroutine-closure shim to account for the fact that the upvars of the outer coroutine-closure and the inner coroutine might not line up due to edition-2021 closure capture rules changes.

Specifically, the number of upvars may differ *and/or* the inner coroutine may have additional projections applied to an upvar. This PR reworks the information we pass into the `ByMoveBody` MIR visitor to account for both of these facts.

I tried to leave comments explaining exactly what everything is doing, but let me know if you have questions.

r? oli-obk
2024-04-08 22:06:21 +02:00
Matthias Krüger
0e27c99332
Rollup merge of #123367 - jswrenn:layoutify, r=compiler-errors
Safe Transmute: Compute transmutability from `rustc_target::abi::Layout`

In its first step of computing transmutability, `rustc_transmutability` constructs a byte-level representation of type layout (`Tree`). Previously, this representation was computed for ADTs by inspecting the ADT definition and performing our own layout computations. This process was error-prone, verbose, and limited our ability to analyze many types (particularly default-repr types).

In this PR, we instead construct `Tree`s from `rustc_target::abi::Layout`s. This helps ensure that layout optimizations are reflected our analyses, and increases the kinds of types we can now analyze, including:
- default repr ADTs
- transparent unions
- `UnsafeCell`-containing types

Overall, this PR expands the expressvity of `rustc_transmutability` to be much closer to the transmutability analysis performed by miri. Future PRs will work to close the remaining gaps (e.g., support for `Box`, raw pointers, `NonZero*`, coroutines, etc.).

r? `@compiler-errors`
2024-04-08 22:06:21 +02:00
Matthias Krüger
ecfc3384f1
Rollup merge of #122781 - nikic:ppc-abi-fix, r=cuviper
Fix argument ABI for overaligned structs on ppc64le

When passing a 16 (or higher) aligned struct by value on ppc64le, it needs to be passed as an array of `i128` rather than an array of `i64`. This will force the use of an even starting doubleword.

For the case of a 16 byte struct with alignment 16 it is important that `[1 x i128]` is used instead of `i128` -- apparently, the latter will get treated similarly to `[2 x i64]`, not exhibiting the correct ABI. Add a `force_array` flag to `Uniform` to support this.

The relevant clang code can be found here:
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L878-L884)
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L780-L784)

I think the corresponding psABI wording is this:

> Fixed size aggregates and unions passed by value are mapped to as
> many doublewords of the parameter save area as the value uses in
> memory. Aggregrates and unions are aligned according to their
> alignment requirements. This may result in doublewords being
> skipped for alignment.

In particular the last sentence. Though I didn't find any wording for Clang's behavior of clamping the alignment to 16.

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

r? `@cuviper`
2024-04-08 22:06:20 +02:00
León Orell Valerian Liehr
114e88c9d0
rustdoc: synthetic auto: filter out clauses from the implementor's ParamEnv
not just the ones from the elaborated clauses.
2024-04-08 20:41:04 +02:00
bors
211518e5fb Auto merge of #120614 - DianQK:simplify-switch-int, r=cjgillot
Transforms match into an assignment statement

Fixes #106459.

We should be able to do some similar transformations, like `enum` to `enum`.

r? mir-opt
2024-04-08 18:28:50 +00:00
Matthew Maurer
284da5d6b4 CFI: Fix ICE in KCFI non-associated function pointers
We oddly weren't testing the more usual case of casting non-methods to
function pointers. The KCFI shim insertion logic would ICE on these due
to asking for an irrefutable associated item if we cast a function to a
function pointer without needing a traditional shim.
2024-04-08 17:00:18 +00:00
bors
537aab7a2e Auto merge of #120131 - oli-obk:pattern_types_syntax, r=compiler-errors
Implement minimal, internal-only pattern types in the type system

rebase of https://github.com/rust-lang/rust/pull/107606

You can create pattern types with `std::pat::pattern_type!(ty is pat)`. The feature is incomplete and will panic on you if you use any pattern other than integral range patterns. The only way to create or deconstruct a pattern type is via `transmute`.

This PR's implementation differs from the MCP's text. Specifically

> This means you could implement different traits for different pattern types with the same base type. Thus, we just forbid implementing any traits for pattern types.

is violated in this PR. The reason is that we do need impls after all in order to make them usable as fields. constants of type `std::time::Nanoseconds` struct are used in patterns, so the type must be structural-eq, which it only can be if you derive several traits on it. It doesn't need to be structural-eq recursively, so we can just manually implement the relevant traits on the pattern type and use the pattern type as a private field.

Waiting on:

* [x] move all unrelated commits into their own PRs.
* [x] fix niche computation (see 2db07f94f44f078daffe5823680d07d4fded883f)
* [x] add lots more tests
* [x] T-types MCP https://github.com/rust-lang/types-team/issues/126 to finish
* [x] some commit cleanup
* [x] full self-review
* [x] remove 61bd325da19a918cc3e02bbbdce97281a389c648, it's not necessary anymore I think.
* [ ] ~~make sure we never accidentally leak pattern types to user code (add stability checks or feature gate checks and appopriate tests)~~ we don't even do this for the new float primitives
* [x] get approval that [the scope expansion to trait impls](https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/Pattern.20types.20types-team.23126/near/427670099) is ok

r? `@BoxyUwU`
2024-04-08 16:25:23 +00:00
Jack Wrenn
3aa14e3b2e Compute transmutability from rustc_target::abi::Layout
In its first step of computing transmutability, `rustc_transmutability`
constructs a byte-level representation of type layout (`Tree`). Previously, this
representation was computed for ADTs by inspecting the ADT definition and
performing our own layout computations. This process was error-prone, verbose,
and limited our ability to analyze many types (particularly default-repr types).

In this PR, we instead construct `Tree`s from `rustc_target::abi::Layout`s. This
helps ensure that layout optimizations are reflected our analyses, and increases
the kinds of types we can now analyze, including:
- default repr ADTs
- transparent unions
- `UnsafeCell`-containing types

Overall, this PR expands the expressvity of `rustc_transmutability` to be much
closer to the transmutability analysis performed by miri. Future PRs will work
to close the remaining gaps (e.g., support for `Box`, raw pointers, `NonZero*`,
coroutines, etc.).
2024-04-08 15:36:52 +00:00
León Orell Valerian Liehr
8a24ddf64b
Be more specific when flagging imports that are redundant due to the extern prelude 2024-04-08 17:34:06 +02:00
Oli Scherer
dc97b1eb58 Ensure the canonical_param_env_cache does not contain inconsistent information about the defining anchor 2024-04-08 15:08:06 +00:00
Oli Scherer
c8dfb59406 bless mir-opt tests 2024-04-08 15:08:06 +00:00
Oli Scherer
cd9453c637 Mark some tests as known-bugs and add the test case from the corresponding issue 2024-04-08 15:08:06 +00:00
Oli Scherer
dd72bf922a Scrape extraneous regions from instantiate_nll_query_response_and_region_obligations 2024-04-08 15:00:26 +00:00
Oli Scherer
19bd91d128 Pass list of defineable opaque types into canonical queries 2024-04-08 15:00:26 +00:00
Oli Scherer
0689a4f4f7 Add regression test 2024-04-08 15:00:03 +00:00
5225225
65df93bbb4
move exit-code to rmake 2024-04-08 14:41:16 +01:00
Matthias Krüger
17c94b5f12
Rollup merge of #123089 - Philippe-Cholet:vecdeque_pop_assume_cap, r=Nilstrieb
Add invariant to VecDeque::pop_* that len < cap if pop successful

Similar to #114370 for VecDeque instead of Vec.

I initially come from https://github.com/rust-itertools/itertools/pull/899 where we noticed that `pop_front;push_back;` was slower than expected so `@scottmcm` suggested I file an issue which lead to https://internals.rust-lang.org/t/vecdeque-pop-front-push-back/20483 where **kornel** mentionned #114334 (fixed by #114370).

This is my first time with codegen tests, I based the test on what was done for Vec.
2024-04-08 14:31:11 +02:00
Matthias Krüger
337be99bb6
Rollup merge of #120144 - petrochenkov:unty, r=davidtwco
privacy: Stabilize lint `unnameable_types`

This is the last piece of ["RFC #2145: Type privacy and private-in-public lints"](https://github.com/rust-lang/rust/issues/48054).

Having unstable lints is not very useful because you cannot even dogfood them in the compiler/stdlib in this case (https://github.com/rust-lang/rust/pull/113284).
The worst thing that may happen when a lint is removed are some `removed_lints` warnings, but I haven't heard anyone suggesting removing this specific lint.

This lint is allow-by-default and is supposed to be enabled explicitly.
Some false positives are expected, because sometimes unnameable types are a legitimate pattern.
This lint also have some unnecessary false positives, that can be fixed - see https://github.com/rust-lang/rust/issues/120146 and https://github.com/rust-lang/rust/issues/120149.

Closes https://github.com/rust-lang/rust/issues/48054.
2024-04-08 14:31:10 +02:00
Oli Scherer
18ff131c4e Normalize layout test to protect against android alignment differences 2024-04-08 12:06:28 +00:00
Oli Scherer
84acfe86de Actually create ranged int types in the type system. 2024-04-08 12:02:19 +00:00
Oli Scherer
6b24a9cf70 Test macros 2024-04-08 12:02:12 +00:00
Oli Scherer
1d6cd8daf0 Start handling pattern types at the HIR -> Ty conversion boundary 2024-04-08 12:01:50 +00:00
Oli Scherer
c340e67dec Add pattern types to parser 2024-04-08 11:57:17 +00:00
DianQK
166bb1bd46
Don't change the otherwise of the switch 2024-04-08 19:20:07 +08:00
DianQK
928c57dc9a
Add test case for #119014 2024-04-08 19:20:04 +08:00
DianQK
e752af765e
Transforms a match containing negative numbers into an assignment statement as well 2024-04-08 19:00:57 +08:00
DianQK
1f061f47e2
Transforms match into an assignment statement 2024-04-08 19:00:53 +08:00
DianQK
badb73b921
Update matches_reduce_branches.rs 2024-04-08 18:54:33 +08:00
Guillaume Gomez
66bc97cc88 Make theme switching closer to reality 2024-04-08 12:14:41 +02:00
Philippe-Cholet
7a2678de7d Add invariant to VecDeque::pop_* that len < cap if pop successful
Similar to #114370 for VecDeque instead of Vec. It now uses `core::hint::assert_unchecked`.
2024-04-08 12:12:13 +02:00
bors
0e5f520788 Auto merge of #123577 - Urgau:prep-work-for-compiletest-check-cfg, r=oli-obk
Do some preparation work for compiletest check-cfg

This PR does several preparation work for having always-on check-cfg in compiletest.

In particular, this PR does two main things:
 - It unifies all the *always-false* cfgs under the `FALSE` cfg (as it seems to be the convention under `tests/ui`)
 - It also removes some useless conditions

This is done ahead of the introduction of the always-on check-cfg in compiletest to reduce the amount of changes in that follow-up work. I also think that this is useful even without that follow-up work.
2024-04-08 09:34:44 +00:00
bors
7a495cc13d Auto merge of #123616 - bzEq:fix-be-test, r=jhpratt
[Test] issue-122805.rs should limit to little endian target

In issue-122805.rs, codegen on big endian target is different from little endian target.
```llvm
%0 = load <8 x i16>, ptr %value, align 2
store <8 x i16> %0, ptr %_0, align 1
ret void
```
This is expected since the conversion is unnecessary on BE target for this case.
2024-04-08 04:16:16 +00:00
Kai Luo
d8d1e6ce21 Limited to little endian target 2024-04-08 11:11:11 +08:00
Nikita Popov
009280c5e3 Fix argument ABI for overaligned structs on ppc64le
When passing a 16 (or higher) aligned struct by value on ppc64le,
it needs to be passed as an array of `i128` rather than an array
of `i64`. This will force the use of an even starting register.

For the case of a 16 byte struct with alignment 16 it is important
that `[1 x i128]` is used instead of `i128` -- apparently, the
latter will get treated similarly to `[2 x i64]`, not exhibiting
the correct ABI. Add a `force_array` flag to `Uniform` to support
this.

The relevant clang code can be found here:
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L878-L884)
fe2119a7b0/clang/lib/CodeGen/Targets/PPC.cpp (L780-L784)

I think the corresponding psABI wording is this:

> Fixed size aggregates and unions passed by value are mapped to as
> many doublewords of the parameter save area as the value uses in
> memory. Aggregrates and unions are aligned according to their
> alignment requirements. This may result in doublewords being
> skipped for alignment.

In particular the last sentence.

Fixes https://github.com/rust-lang/rust/issues/122767.
2024-04-08 11:15:36 +09:00
Caio
ab8994d93e Move tests 2024-04-07 17:38:07 -03:00
bors
9d5cdf75aa Auto merge of #123601 - jieyouxu:compiletest-run-rustfix-revisions, r=WaffleLapkin
compiletest: properly handle revisioned run-rustfix tests

Before this PR, if you have a revisioned `//@ run-rustfix` test like `//`@[foo]` run-rustfix`, you would run into an error saying crate name cannot contain `.` characters because the fixed test file trying to be compiled is named `<test-name>.<revision>.fixed`, from which `rustc` infers the crate name to be `<test-name>.<revision>` which is not a valid crate name.

This PR fixes the problem by constructing a synthetic crate name from `<test-name>.<revision>`, by

1. replacing all `-` with `_`, and
2. replacing all `.` with `__`

and pass that constructed crate name with `--crate-name` to rustc to compile the fixed file.

Fixes https://github.com/rust-lang/rust/issues/123596.
2024-04-07 18:22:55 +00:00
许杰友 Jieyou Xu (Joe)
de3857e553 tests/ui: remove workaround for broken revisioned run-rustfix test 2024-04-07 17:06:15 +00:00
许杰友 Jieyou Xu (Joe)
5dc276c0da compiletest: properly handle revisioned run-rustfix tests 2024-04-07 17:06:15 +00:00
许杰友 Jieyou Xu (Joe)
d4aeff711e Port over backtrace's line-tables-only test to a ui test 2024-04-07 15:25:38 +00:00
DianQK
f5c256fa0f
Add FileCheck for early_otherwise_branch*.rs 2024-04-07 21:14:29 +08:00
DianQK
31e74771f0
Resolve unsound hoisting of discriminant in EarlyOtherwiseBranch 2024-04-07 21:14:26 +08:00
bors
4e431fad67 Auto merge of #123561 - saethlin:str-unchecked-sub-index, r=scottmcm
Use unchecked_sub in str indexing

https://github.com/rust-lang/rust/pull/108763 applied this logic to indexing for slices, but of course `str` has its own separate impl.

Found this by skimming over the codegen for https://github.com/oxidecomputer/hubris/; their dist builds enable overflow checks so the lack of `unchecked_sub` was producing an impossible-to-hit overflow check and also inhibiting some inlining.

r? scottmcm
2024-04-07 12:49:15 +00:00
bors
fc1a4c5cc9 Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu
Save/restore more items in cache with incremental compilation

Right now they don't play very well together, consider a simple example:

```
$ export RUSTFLAGS="--emit asm"
$ cargo new --lib foo
     Created library `foo` package
$ cargo build -q
$ touch src/lib.rs
$ cargo build
error: could not copy
  "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.4qbzn9k8mosu50a5.rcgu.s"
  to "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.s":
  No such file or directory (os error 2)
```

Touch triggers the rebuild, incremental compilation detects no changes (yay) and everything explodes while trying to copy files were they should go.

This pull request fixes it by copying and restoring more files in the incremental compilation cache

Fixes https://github.com/rust-lang/rust/issues/89149
Fixes https://github.com/rust-lang/rust/issues/88829

Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
2024-04-07 10:46:50 +00:00
bors
8f2c255ae0 Auto merge of #123585 - matthiaskrgr:rollup-dexaj7a, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #123410 (Relax framework linking test)
 - #123446 (Fix incorrect 'llvm_target' value used on watchOS target)
 - #123579 (add some more tests)
 - #123581 (Add `f16` and `f128` to rustdoc's `PrimitiveType`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-04-07 08:44:19 +00:00
Matthias Krüger
549d85d13f
Rollup merge of #123581 - tgross35:f16-f128-rustdoc-updates, r=fmease
Add `f16` and `f128` to rustdoc's `PrimitiveType`

Fix a few places where these primitives were missing from librustdoc. This should fix the CI failures from doc links in https://github.com/rust-lang/rust/pull/122470.
2024-04-07 09:17:16 +02:00
Matthias Krüger
bbc7807b42
Rollup merge of #123579 - matthiaskrgr:I_Love_Tests, r=jieyouxu
add some more tests

Fixes https://github.com/rust-lang/rust/issues/115806
Fixes https://github.com/rust-lang/rust/issues/116710
Fixes https://github.com/rust-lang/rust/issues/123145
Fixes https://github.com/rust-lang/rust/issues/105488
Fixes https://github.com/rust-lang/rust/issues/122488
Fixes https://github.com/rust-lang/rust/issues/123078
2024-04-07 09:17:15 +02:00
Matthias Krüger
4eef6e313e
Rollup merge of #123410 - madsmtm:relax-framework-linking-test, r=fmease
Relax framework linking test

This test was introduced by myself in https://github.com/rust-lang/rust/pull/118644, but was over-specified in that it assumed the path of the linker was always `cc`, which [causes a test failure for Chromium](https://issues.chromium.org/issues/332562251).
2024-04-07 09:17:14 +02:00
bors
0e3235f85b Auto merge of #123555 - DianQK:update-llvm-18, r=cuviper
Update to LLVM 18.1.3

Fixes #122805.

This should work on all targets: https://rust.godbolt.org/z/svW8ha31z.

r? `@cuviper`
2024-04-07 06:33:58 +00:00
DianQK
5acfe772fa
Add the test case for #122805 2024-04-07 13:01:54 +08:00
Trevor Gross
ebc86e6f58 Add f16 and f128 to rustdoc's PrimitiveType
Fix a few places where these primitives were missing from librustdoc.
2024-04-06 23:47:40 -04:00
Matthias Krüger
88aa71f108 add test for assertion failed: !value.has_infer() #115806
Fixes https://github.com/rust-lang/rust/issues/115806
2024-04-07 01:45:31 +02:00
Rémy Rakic
54f8db8432 add non-regression test for issue 123275 2024-04-06 23:25:58 +00:00
Matthias Krüger
b976142439 add test for ice: unknown alias DefKind: AnonConst #116710
Fixes https://github.com/rust-lang/rust/issues/116710
2024-04-07 01:20:56 +02:00
Urgau
47ff773632 Rename invalid false cfg to valid _false cfg
While `false` is accepted by `--cfg` it isn't by `#[cfg(false)]`
since in that context `false` is the boolean not a ident.
2024-04-07 01:16:46 +02:00
Urgau
3ba0139c66 Remove useless configs in tests
Since they are never set and don't have impact on the test.

Or for the cfg-panic tests are already tested with check-cfg.
2024-04-07 01:16:45 +02:00
Urgau
c4a97d9407 Unify all the always-false cfgs under the FALSE cfg 2024-04-07 01:16:45 +02:00
Matthias Krüger
96dbde796c
Rollup merge of #123563 - Oneirical:version, r=jieyouxu
Rewrite `version` test run-make as an UI test

Claiming the simple `version` test from #121876.

Reasoning: As discussed in #123297, 10 years ago, some changes to CLI flags warranted the creation of the `version` test. Since it's not actually executing the compiled binary, it has no purpose being a `run-make` test and should instead be an UI test.

This is the exact same change as it was shown on my closed PR #123297. Changes were ready, but I did a major Git mishap while trying to fix a tidy error and messed up my branch. The details of this error are explained [here](https://github.com/rust-lang/rust/pull/123297#issuecomment-2041152379).
2024-04-07 00:51:27 +02:00
Matthias Krüger
f51ce75af4
Rollup merge of #123516 - estebank:issue-123428, r=compiler-errors
Do not ICE on field access check on expr with `ty::Error`

Fix #123428
2024-04-07 00:51:26 +02:00
Matthias Krüger
84dca1503e
Rollup merge of #123411 - saethlin:ub-checks, r=Urgau,RalfJung
Put checks that detect UB under their own flag below debug_assertions

Implementation of https://github.com/rust-lang/compiler-team/issues/725
2024-04-07 00:51:25 +02:00
Matthias Krüger
7c43bc0378 add test for ICE: failed to resolve instance for <fn() -> impl ...> #123145
Fixes https://github.com/rust-lang/rust/issues/123145
2024-04-07 00:48:47 +02:00
Matthias Krüger
7836909402 add test for ice called Option::unwrap() on a None value in collector.rs:934:13 #105488
Fixes https://github.com/rust-lang/rust/issues/105488
2024-04-07 00:25:56 +02:00
Matthias Krüger
7d9e1067fd add test for ICE: Unexpected unsized type tail: &ReStatic [u8] #122488
Fixes https://github.com/rust-lang/rust/issues/122488
2024-04-06 23:34:46 +02:00
Matthias Krüger
5dc7fe473b add test for ICE: !base.layout().is_sized() #123078
Fixes https://github.com/rust-lang/rust/issues/123078
2024-04-06 23:30:51 +02:00
Oneirical
a9c0ffa35b Rewrite version test as UI test
fix: re-add stout ignore

restore does-nothing

fix: universal check-pass
2024-04-06 15:14:16 -04:00
Scott McMurray
00bd24766f Don't emit divide-by-zero panic paths in StepBy::len
I happened to notice today that there's actually two such calls emitted in the assembly: <https://rust.godbolt.org/z/1Wbbd3Ts6>

Since they're impossible, hopefully telling LLVM that will also help optimizations elsewhere.
2024-04-06 11:37:57 -07:00
Ben Kimock
712aab72df Use unchecked_sub in str indexing 2024-04-06 14:09:03 -04:00
Esteban Küber
97ea48ce32 Do not ICE on field access check on expr with ty::Error
Fix #123428
2024-04-06 16:34:57 +00:00
Guillaume Gomez
3a203b0ada
Rollup merge of #123554 - GuillaumeGomez:cleanup-search-result-color, r=notriddle
Simplify/cleanup `search-result-color.goml`

Greatly shorten code of `search-result-color.goml` GUI test.

I split the changes into smaller commits to allow to more easily see what changed.

r? `@notriddle`
2024-04-06 17:37:41 +02:00
Guillaume Gomez
79a97b3999
Rollup merge of #123552 - bjorn3:fix-spike-neg, r=Mark-Simulacrum
Add missing -Zquery-dep-graph to the spike-neg incr comp tests

This ensures that the tests actually test what they are meant to test rather than exitting immediately with an error that -Zquery-dep-graph has to be passed.
2024-04-06 17:37:40 +02:00