Commit Graph

11680 Commits

Author SHA1 Message Date
Matthias Krüger f19cb0b294
Rollup merge of #127711 - BoxyUwU:add_effects_test, r=fee1-dead
Add regression test for a gce + effects ICE

Fixes #125770

I'm not *exactly* sure why this stopped ICEing, I assume its something to do with the fact that there used to be a generic parameter on `Add` for the host generic and we have mismatched args here, which #125608 made no longer later cause issues. But now the desugaring is also different so? 🤷‍♀️

r? `@fee1-dead`
2024-07-14 20:25:00 +02:00
bors 88fa119c77 Auto merge of #127670 - compiler-errors:no-type-length-limit, r=jackh726
Gate the type length limit check behind a nightly flag

Effectively disables the type length limit by introducing a `-Zenforce-type-length-limit` which defaults to **`false`**, since making the length limit actually be enforced ended up having a worse fallout than expected. We still keep the code around, but the type length limit attr is now a noop (except for its usage in some diagnostics code?).

r? `@lcnr` -- up to you to decide what team consensus we need here since this reverses an FCP decision.

Reopens #125460 (if we decide to reopen it or keep it closed)
Effectively reverses the decision FCP'd in #125507
Closes #127346
2024-07-14 12:44:07 +00:00
bors 0ffbddd09e Auto merge of #127087 - cjgillot:small-map, r=oli-obk
Only track mentioned places for jump threading

This PR aims to reduce the state space size in jump threading and dataflow const-prop opts.

The current implementation walks the types of all locals, and creates a place for each possible projection. This can easily lead to a large number of places and tracked values, most being useless to the actual pass.

With this PR, we instead collect places that appear syntactically in the MIR (first commit). However, this is not sufficient (second commit), and we miss places that we could track in aggregate assignments. The third commit tracks such assignments to mirror place projections, see the inline comment.

This is complementary to https://github.com/rust-lang/rust/pull/127036

r? `@oli-obk`
2024-07-14 08:01:21 +00:00
Boxy a54dbbfd0e add_effects_test 2024-07-14 07:57:53 +01:00
Jubilee 6a3566c2b0
Rollup merge of #127671 - notriddle:notriddle/issue-d, r=Mark-Simulacrum
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 8)

Follow up

* https://github.com/rust-lang/rust/pull/116214
* https://github.com/rust-lang/rust/pull/116432
* https://github.com/rust-lang/rust/pull/116824
* https://github.com/rust-lang/rust/pull/118105
* https://github.com/rust-lang/rust/pull/119561
* https://github.com/rust-lang/rust/pull/123574
* https://github.com/rust-lang/rust/pull/125382

As always, it's easier to review the commits one at a time. Don't use the Files Changed tab. It's confusing.
2024-07-13 20:19:48 -07:00
Jubilee 4c493db0d9
Rollup merge of #122300 - CastilloDel:master, r=cjgillot
Add FileCheck annotations to mir-opt/dest-prop tests

Part of https://github.com/rust-lang/rust/issues/116971, adds FileCheck annotations to MIR-opt tests in tests/mir-opt/dest-prop.

I would like some feedback. Also, I don't know how to approach `union.rs`.  I couldn't figure out what it is testing.

r? cjgillot
2024-07-13 20:19:45 -07:00
bors 25acbbd12f Auto merge of #127435 - GrigorenkoPV:tests-for-112905, r=cjgillot
Add tests for #112905

This is a part of #105107. Adds the tests from the OP in #112905.
2024-07-13 13:12:52 +00:00
Camille GILLOT 6e3cff7094 Bless coverage. 2024-07-13 12:02:12 +00:00
Camille GILLOT 7ac7f135e3 Propagate places through assignments. 2024-07-13 12:02:10 +00:00
Camille GILLOT af876626b0 Add test for copying aggregates. 2024-07-13 11:54:30 +00:00
Camille GILLOT 76f5bc6a9f Create mapped places upon seeing them in the body. 2024-07-13 11:54:25 +00:00
bors 0065384608 Auto merge of #127397 - jyn514:multi-thread-panic-hook, r=workingjubilee
fix interleaved output in the default panic hook when multiple threads panic simultaneously

previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook from one thread would be interleaved with the backtrace from another. now, we hold the lock for the full duration of the hook, and the output is ordered.

---

i noticed some odd things while working on this you may or may not already be aware of.

- libbacktrace is included as a submodule instead of a normal rustc crate, and as a result uses `cfg(backtrace_in_std)` instead of a more normal `cfg(feature = "rustc-dep-of-std")`. probably this is left over from before rust used a cargo-based build system?
- the default panic handler uses `trace_unsynchronized`, etc, in `sys::backtrace::print`. as a result, the lock only applies to concurrent *panic handlers*, not concurrent *threads*.  in other words, if another, non-panicking, thread tried to print a backtrace at the same time as the panic handler, we may have UB, especially on windows.
    - we have the option of changing backtrace to enable locking when `backtrace_in_std` is set so we can reuse their lock instead of trying to add our own.
2024-07-13 03:42:24 +00:00
Michael Howell 42ee400b0f Move assertion-free rustdoc ice tests to rustdoc-ui 2024-07-12 18:18:30 -07:00
Michael Goulet 938ed369ad Gate the type length limit check behind a nightly flag 2024-07-12 21:16:09 -04:00
Michael Howell 17419f6499 rustdoc: rename `issue-\d+.rs` tests to have meaningful names 2024-07-12 18:14:37 -07:00
Michael Howell 4d35754c46 Add URL and crate_name to test cases 2024-07-12 17:36:21 -07:00
bors 336e89bd15 Auto merge of #127665 - workingjubilee:rollup-g90yr21, r=workingjubilee
Rollup of 11 pull requests

Successful merges:

 - #126502 (Ignore allocation bytes in some mir-opt tests)
 - #126922 (add lint for inline asm labels that look like binary)
 - #127209 (Added the `xop` target-feature and the `xop_target_feature` feature gate)
 - #127310 (Fix import suggestion ice)
 - #127338 (Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests to rmake)
 - #127381 (Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `run-make` tests to rmake)
 - #127535 (Fire unsafe_code lint on unsafe extern blocks)
 - #127619 (Suggest using precise capturing for hidden type that captures region)
 - #127631 (Remove `fully_normalize`)
 - #127632 (Implement `precise_capturing` support for rustdoc)
 - #127660 (Rename the internal `const_strlen` to just `strlen`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-12 22:59:30 +00:00
Jubilee c0d949909f
Rollup merge of #127632 - compiler-errors:precise-capturing-rustdoc, r=fmease
Implement `precise_capturing` support for rustdoc

Implements rustdoc (+json) support for local (i.e. non-cross-crate-inlined) RPITs with `use<...>` precise capturing syntax.

Tests kinda suck. They're really hard to write 😰

r? `@fmease` or re-roll if you're too busy!
also cc `@aDotInTheVoid` for the json side

Tracking:
* https://github.com/rust-lang/rust/issues/127228#issuecomment-2201443216 (not fully fixed for cross-crate-inlined opaques)
* https://github.com/rust-lang/rust/issues/123432
2024-07-12 13:47:10 -07:00
Jubilee 20cf4eb3b0
Rollup merge of #127619 - compiler-errors:precise-capturing-better-sugg, r=oli-obk
Suggest using precise capturing for hidden type that captures region

Adjusts the "add `+ '_`" suggestion for opaques to instead suggest adding or reusing the `+ use<>` in the opaque.

r? oli-obk or please re-roll if you're busy!
2024-07-12 13:47:09 -07:00
Jubilee 2e0591b1e9
Rollup merge of #127535 - spastorino:unsafe_code-unsafe_extern_blocks, r=oli-obk
Fire unsafe_code lint on unsafe extern blocks

Fixes #126738
2024-07-12 13:47:08 -07:00
Jubilee 38c314e29d
Rollup merge of #127381 - Oneirical:testalt-consciousness, r=jieyouxu
Migrate `issue-83045`, `rustc-macro-dep-files` and `env-dep-info` `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).

Please try on musl.

try-job: dist-x86_64-musl
2024-07-12 13:47:08 -07:00
Jubilee 6cdef05a71
Rollup merge of #127338 - Oneirical:ready-your-arbatests, r=jieyouxu
Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-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).

Please try:

try-job: armhf-gnu
// try-job: test-various // already tried
try-job: x86_64-msvc
try-job: aarch64-apple
2024-07-12 13:47:07 -07:00
Jubilee afb2fbf692
Rollup merge of #127310 - chenyukang:yukang-fix-suggest-import-ice, r=estebank
Fix import suggestion ice

Fixes #127302

#127302 only crash in edition 2015
#120074 can only reproduced in edition 2021
so I added revisions in test file.
2024-07-12 13:47:07 -07:00
Jubilee a6a7129827
Rollup merge of #127209 - sayantn:xop, r=Amanieu
Added the `xop` target-feature and the `xop_target_feature` feature gate

This is an effort towards #127208. This adds the `xop` target feature gated by `xop_target_feature`.
2024-07-12 13:47:06 -07:00
Jubilee fc0136e4f4
Rollup merge of #126922 - asquared31415:asm_binary_label, r=estebank
add lint for inline asm labels that look like binary

fixes #94426

Due to a bug/feature in LLVM, labels composed of only the digits `0` and `1` can sometimes be confused with binary literals, even if a binary literal would not be valid in that position.

This PR adds detection for such labels and also as a drive-by change, adds a note to cases such as `asm!(include_str!("file"))` that the label that it found came from an expansion of a macro, it wasn't found in the source code.

I expect this PR to upset some people that were using labels `0:` or `1:` without issue because they never hit the case where LLVM got it wrong, but adding a heuristic to the lint to prevent this is not feasible - it would involve writing a whole assembly parser for every target that we have assembly support for.

[zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202024-06-20/near/445870628)

r? ``@estebank``
2024-07-12 13:47:05 -07:00
Jubilee 5d56572f06
Rollup merge of #126502 - cuviper:dump-mir-exclude-alloc-bytes, r=estebank
Ignore allocation bytes in some mir-opt tests

This adds `rustc -Zdump-mir-exclude-alloc-bytes` to skip writing allocation bytes in MIR dumps, and applies it to tests that were failing on s390x due to its big-endian byte order.

Fixes #126261
2024-07-12 13:47:05 -07:00
bors c6727fc9b5 Auto merge of #123351 - beetrees:x86-ret-snan-rust, r=nikic,workingjubilee
Ensure floats are returned losslessly by the Rust ABI on 32-bit x86

Solves #115567 for the (default) `"Rust"` ABI. When compiling for 32-bit x86, this PR changes the `"Rust"` ABI to return floats indirectly instead of in x87 registers (with the exception of single `f32`s, which this PR returns in general purpose registers as they are small enough to fit in one). No change is made to the `"C"` ABI as that ABI requires x87 register usage and therefore will need a different solution.
2024-07-12 20:36:43 +00:00
sayantn 1fd0311eab Added the `xop` target feature and `xop_target_feature` gate 2024-07-12 23:30:22 +05:30
jyn 1c8f9bb84d fix interleaved panic output
previously, we only held a lock for printing the backtrace itself. since all threads were printing to the same file descriptor, that meant random output in the default panic hook would be interleaved with the backtrace. now, we hold the lock for the full duration of the hook, and the output is ordered.
2024-07-12 11:52:04 -04:00
Oneirical fe76650144 rewrite env-dep-info to rmake 2024-07-12 10:58:20 -04:00
Oneirical 87c7a42ba9 rewrite rustc-macro-dep-files to rmake 2024-07-12 10:57:58 -04:00
Oneirical f768db6ba6 rewrite and rename issue-83045 to rmake 2024-07-12 10:57:57 -04:00
Oneirical c6cdbe635b rewrite and rename issue-85019-moved-src-dir to rmake 2024-07-12 10:45:39 -04:00
Oneirical cef8a044ea rewrite extra-filename-with-temp-outputs to rmake 2024-07-12 10:45:38 -04:00
Matthias Krüger 18152d72a4
Rollup merge of #126639 - sayantn:amx, r=Amanieu
Add AMX target-features and `x86_amx_intrinsics` feature flag

This is an effort towards #126622. This adds support for all 5 target-features for `AMX`, and introduces the feature flag `x86_amx_intrinsics`, which would gate these target-features and the yet-to-be-implemented amx intrinsics in stdarch.
2024-07-12 14:37:57 +02:00
beetrees cae9d480bf
Adjust tests for x86 "Rust" ABI changes 2024-07-12 10:47:56 +01:00
Michael Goulet bd135e487f Add rustdoc-json support for use<> 2024-07-12 05:24:51 -04:00
Michael Goulet 843f5dd93b Add rustdoc support for use<> in (local) RPITs 2024-07-12 05:24:51 -04:00
bors b286722878 Auto merge of #127635 - matthiaskrgr:rollup-foopajr, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #127164 (match lowering: Clarify the main loop of the algorithm)
 - #127422 (as_simd: fix doc comment to be in line with align_to)
 - #127596 (More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>`)
 - #127607 (compiletest: Better error message for bad `normalize-*` headers)
 - #127622 (Mark `builtin_syntax` as internal)
 - #127625 (Revert accidental comment deletion)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-12 03:40:38 +00:00
sayantn ec05c4ea3f Add the feature gate and target-features 2024-07-11 19:00:49 -07:00
Matthias Krüger 83d1a1b252
Rollup merge of #127596 - tesuji:help-unwrap-or, r=compiler-errors
More suggestion for converting `Option<&Vec<T>>` to `Option<&[T]>`

Please review commit-by-commit.
2024-07-12 03:43:35 +02:00
Matthias Krüger 58fe37f2c3
Rollup merge of #127164 - Nadrieril:clean-lowering-loop, r=matthewjasper
match lowering: Clarify the main loop of the algorithm

Now that we expand or-patterns in a single place in the algorithm, we can move it (back) to the main part of the loop. This makes the call-graph of the main loop rather simple: `match_candidates` has three branches that each call back to `match_candidates`. The remaining tricky part is `finalize_or_candidate`.

I also factored out the whole "process a prefix of the candidates then process the rest" thing which I think helps legibility.

The first two commits are a fix for an indexing mistake I introduced in https://github.com/rust-lang/rust/pull/126553, already sumitted in https://github.com/rust-lang/rust/pull/127028 but feel free to merge this first.

r? `@matthewjasper`
2024-07-12 03:43:34 +02:00
bors 4a31a6c32a Auto merge of #127382 - estebank:const-let, r=compiler-errors
Use verbose style when suggesting changing `const` with `let`
2024-07-12 01:18:12 +00:00
Lzu Tao 872d7b82e1 Add suggestion for `Option<&Vec<T>> -> Option<&[T]` 2024-07-11 22:50:23 +00:00
Lzu Tao d9170dc666 Add regression test for issue 127545 2024-07-11 22:50:23 +00:00
Esteban Küber 4df75140dd Fix aarch64 test 2024-07-11 20:40:02 +00:00
Esteban Küber cbe75486f7 Account for `let foo = expr`; to suggest `const foo: Ty = expr;` 2024-07-11 20:39:24 +00:00
Esteban Küber b56dc8ee90 Use verbose style when suggesting changing `const` with `let` 2024-07-11 20:39:24 +00:00
Michael Goulet 03bee1e1e5 Suggest using precise capturing for hidden type that captures region 2024-07-11 14:01:29 -04:00
Matthias Krüger fa3ce50f0b
Rollup merge of #127605 - nikic:remove-extern-wasm, r=oli-obk
Remove extern "wasm" ABI

Remove the unstable `extern "wasm"` ABI (`wasm_abi` feature tracked in #83788).

As discussed in https://github.com/rust-lang/rust/pull/127513#issuecomment-2220410679 and following, this ABI is a failed experiment that did not end up being used for anything. Keeping support for this ABI in LLVM 19 would require us to switch wasm targets to the `experimental-mv` ABI, which we do not want to do.

It should be noted that `Abi::Wasm` was internally used for two things: The `-Z wasm-c-abi=legacy` ABI that is still used by default on some wasm targets, and the `extern "wasm"` ABI. Despite both being `Abi::Wasm` internally, they were not the same. An explicit `extern "wasm"` additionally enabled the `+multivalue` feature.

I've opted to remove `Abi::Wasm` in this patch entirely, instead of keeping it as an ABI with only internal usage. Both `-Z wasm-c-abi` variants are now treated as part of the normal C ABI, just with different different treatment in
adjust_for_foreign_abi.
2024-07-11 17:01:41 +02:00