Commit Graph

310447 Commits

Author SHA1 Message Date
Stuart Cook e5690e73bb Rollup merge of #148777 - ywxt:depth_limit_error, r=petrochenkov
Lock shards while emitting depth limit error.

Locking shards avoids collect_active_jobs isn't able to be completed during emitting depth limit error.

fix rust-lang/rust#142159

Zulip: https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/panic.20while.20depth_limit_error/with/554616169

cc `@Zoxc`
2025-11-14 19:57:07 +11:00
Stuart Cook f61bfb0037 Rollup merge of #148725 - scottmcm:experiment-new-try-block-v3, r=petrochenkov
Implement the alternative `try` block desugaring

As discussed in https://github.com/rust-lang/rfcs/pull/3721#issuecomment-3208342727, update the `try` in nightly to match the RFC as a way to experiment.

This addresses the following unresolved issue from https://github.com/rust-lang/rust/issues/31436

>  Address issues with type inference (`try { expr? }?` currently requires an explicit type annotation somewhere).
2025-11-14 19:57:06 +11:00
Stuart Cook bf7d5539f7 Rollup merge of #148638 - chenyukang:yukang-fix-148634-repr-simd-enum-ice, r=Kivooeo,lcnr
Fix ICE for repr simd on non struct

Fixes rust-lang/rust#148634

The ICE happened because
https://github.com/rust-lang/rust/blob/995c11894fdabe1c630694254de756f82389c6cf/compiler/rustc_middle/src/ty/mod.rs#L1531

will always set `IS_SIMD` according to `get_all_attrs`, and since we already report error `attribute should be applied to a struct`, it's OK to bypass here.
2025-11-14 19:57:06 +11:00
bors c880acdd31 Auto merge of #148931 - Zalathar:rollup-yfyhpcw, r=Zalathar
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#148543 (Correctly link to associated trait items in reexports)
 - rust-lang/rust#148808 (Some resolve cleanups)
 - rust-lang/rust#148812 (coverage: Associate hole spans with expansion tree nodes )
 - rust-lang/rust#148826 (CStr docs: Fix CStr vs &CStr confusion)
 - rust-lang/rust#148850 (Implement `Read::read_array`)
 - rust-lang/rust#148867 (Refactor `Box::take`)
 - rust-lang/rust#148870 (Remove unused LLVMModuleRef argument)
 - rust-lang/rust#148878 (error when ABI does not support guaranteed tail calls)
 - rust-lang/rust#148901 (Disable rustdoc-test-builder test partially for SGX target.)
 - rust-lang/rust#148902 (add missing s390x target feature to std detect test)
 - rust-lang/rust#148904 (waffle: stop watching codegen ssa)
 - rust-lang/rust#148906 (Expose fmt::Arguments::from_str as unstable.)
 - rust-lang/rust#148907 (add assembly test for infinite recursion with `become`)
 - rust-lang/rust#148928 (Move & adjust some `!`-adjacent tests)
 - rust-lang/rust#148929 (ignore `build-rust-analyzer` even if it's a symlink)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-14 05:29:52 +00:00
yukang 1610851356 add Tainted for NonAsmTypeReason 2025-11-14 12:42:50 +08:00
Scott McMurray e5803fceed Move into_try_type to a free function 2025-11-13 19:53:02 -08:00
Stuart Cook f589579a1d Rollup merge of #148929 - WaffleLapkin:bra-symlink-ignore, r=mati865,jieyouxu
ignore `build-rust-analyzer` even if it's a symlink

r? `@jieyouxu`
2025-11-14 13:14:10 +11:00
Stuart Cook 1c32a0b6bb Rollup merge of #148928 - WaffleLapkin:always-test, r=jieyouxu
Move & adjust some `!`-adjacent tests

I'm trying to clean up tests relating to the never type...
2025-11-14 13:14:10 +11:00
Stuart Cook 6bbc4cb995 Rollup merge of #148907 - folkertdev:tail-call-infinite-recursion, r=WaffleLapkin
add assembly test for infinite recursion with `become`

tracking issue: https://github.com/rust-lang/rust/issues/112788
fixes https://github.com/rust-lang/rust/issues/125698

Check that infinite recursion via `become` does not grow the stack (even on opt-level 0). The incomplete implementation of `become` did not guarantee that earlier. Although it's unlikely this ever regresses we may as well test it and close the issue.

r? ```@WaffleLapkin```
2025-11-14 13:14:08 +11:00
Stuart Cook 355e4cf8d6 Rollup merge of #148906 - m-ou-se:fmt-args-from-str, r=dtolnay
Expose fmt::Arguments::from_str as unstable.

Now that https://github.com/rust-lang/rust/pull/148789 is merged, we can have a fmt::Arguments::from_str. I don't know if we want to commit to always having an implementation that allows for this, but we can expose it as unstable for now so we can play with it.

Tracking issue: https://github.com/rust-lang/rust/issues/148905
2025-11-14 13:14:08 +11:00
Stuart Cook 3ba4d2d687 Rollup merge of #148904 - WaffleLapkin:uncodegenssasitself, r=WaffleLapkin
waffle: stop watching codegen ssa

There is a surprising amount of PRs being open to codegen ssa, notification spam makes me stressed. I don't think knowing everything being changed in cg_ssa is useful for me, as most changes are irrelevant to me.
2025-11-14 13:14:07 +11:00
Stuart Cook e32379b445 Rollup merge of #148902 - folkertdev:detect-s390x-target-feature, r=tgross35
add missing s390x target feature to std detect test

Fix an oversight from https://github.com/rust-lang/rust/pull/145656, where the `is_s390x_feature_detected!` macro and some target features were stabilized, but other target features remain unstable under a new target feature name.

I tested this locally using a `stage1` build on the test file with the `s390x-unknown-linux-gnu` target.

cc ```@uweigand```
r? ```@Amanieu``` (or whoever really)
2025-11-14 13:14:07 +11:00
Stuart Cook 79e10134cf Rollup merge of #148901 - sardok:disable_rustdoc_test_builder_sgx, r=GuillaumeGomez
Disable rustdoc-test-builder test partially for SGX target.

The `rustdoc-test-builder` test started to fail after https://github.com/rust-lang/rust/pull/148608 for SGX target. The reason is, sgx binary can not be executed directly so rustdoc fails to execute passed `--test-builder` binary. This PR simply ignores the success part just like it is ignore for `wasm` target.
2025-11-14 13:14:06 +11:00
Stuart Cook 35a82b8dde Rollup merge of #148878 - folkertdev:tail-call-unsupported-abi, r=WaffleLapkin
error when ABI does not support guaranteed tail calls

Some ABIs cannot support guaranteed tail calls. There isn't really an exhaustive list, so this is a best effort. Conveniently, we already disallow calling most of these directly anyway. The only exception that I was able to trigger an LLVM assertion with so far was `cmse-nonsecure-entry`.

For that calling convention, LLVM specifically notes that  (guaranteed) tail calls cannot be supported:

https://github.com/llvm/llvm-project/blob/28dbbba6c3a4e026e085c48cc022cb97b5d8bc6d/llvm/lib/Target/ARM/ARMISelLowering.cpp#L2331-L2335

---

I have some doubts about the implementation here though. I think it would be nicer to use `CanonAbi`, and move the `become` ABI check into `rustc_hir_typeck`, similar to `check_call_abi`:

https://github.com/rust-lang/rust/blob/d6deffe2debecc66501e50f9573214139ab4d678/compiler/rustc_hir_typeck/src/callee.rs#L157-L194

Both the check for whether an ABI is callable and whether it supports guaranteed tail calls can then be methods (containing exhaustive matches) on `CanonAbi`. I'm however not sure

- if the ABI checks are deliberately only performed when constructing MIR
- what assumptions can be made about the `call` expression in [`check_expr_become`](https://github.com/rust-lang/rust/blob/d6deffe2debecc66501e50f9573214139ab4d678/compiler/rustc_hir_typeck/src/expr.rs#L1126-L1150), it looks like currently the check that the "argument" to `become` is a function call also only occurs later during MIR construction

Are there issues with validating the ABI earlier in `rustc_hir_typeck` that I'm overlooking? I believe that we should already know the call's ABI and whether it is c-variadic at that point.

cc ````@workingjubilee```` for `CanonAbi`, ````@davidtwco```` for cmse
r? ````@WaffleLapkin````
2025-11-14 13:14:04 +11:00
Stuart Cook 9f07b25802 Rollup merge of #148870 - QnnOkabayashi:remove-unused-value, r=wesleywiser
Remove unused LLVMModuleRef argument
2025-11-14 13:14:03 +11:00
Stuart Cook ad91711d79 Rollup merge of #148867 - edwloef:refactor-box-take, r=joboet
Refactor `Box::take`

as per https://github.com/rust-lang/rust/pull/147227#discussion_r2395521349
2025-11-14 13:14:02 +11:00
Stuart Cook 9ff7390470 Rollup merge of #148850 - joshtriplett:read-array, r=joboet
Implement `Read::read_array`

Tracking issue: https://github.com/rust-lang/rust/issues/148848
2025-11-14 13:14:02 +11:00
Stuart Cook 7481e91e65 Rollup merge of #148826 - btj:cstr-docs, r=joboet
CStr docs: Fix CStr vs &CStr confusion

The CStr documentation used to say things about CStr that are only true for &CStr.

Also, it's the bytes that are being borrowed, not the reference. One could say that it's the reference that is doing the borrowing, rather than being borrowed.
2025-11-14 13:14:01 +11:00
Stuart Cook fead508238 Rollup merge of #148812 - Zalathar:expansions, r=JonathanBrouwer
coverage: Associate hole spans with expansion tree nodes

This PR is another incremental step towards expansion region support in coverage instrumentation.

When preparing coverage mappings for a function, we extract “raw” spans from MIR, and then use “hole” spans extracted from HIR to avoid overlap with nested items and closures. That hole-carving process was historically built around the assumption that there would be one set of spans and holes per function, but expansion region support will need to invalidate that assumption.

Therefore, to be more friendly to future work on expansion regions, this PR associates each hole span with its corresponding node in the expansion tree, and makes the span refinement step obtain holes from the current node.

There should be no change to compiler output.
2025-11-14 13:14:00 +11:00
Stuart Cook ee40e0267c Rollup merge of #148808 - nnethercote:resolve-cleanups, r=chenyukang,petrochenkov
Some resolve cleanups

Minor improvements I found while looking over this code.

r? ```````@petrochenkov```````
2025-11-14 13:14:00 +11:00
Stuart Cook 89902f436f Rollup merge of #148543 - GuillaumeGomez:fix-import_trait_associated_functions, r=lolbinarycat
Correctly link to associated trait items in reexports

Fixes rust-lang/rust#148008.

Issue was that we didn't add anchors in this case.

r? ``````@lolbinarycat``````
2025-11-14 13:13:59 +11:00
bors 6d41834e25 Auto merge of #147462 - Enselic:fix-basic-stepping-array, r=saethlin
rustc_codegen_llvm: Require `opt-level >= 1` for index-based write_operand_repeatedly() loop

To make debugger stepping intuitive with `-Copt-level=0`. See the adjusted `basic-stepping.rs` test.

This is kind of a revert of **bd0aae92dc76d9 (cg_llvm: use index-based loop in write_operand_repeatedly)**, except we don't revert it, we just make it conditional on `opt-level`. That commit regressed `basic-stepping.rs`, but it was not noticed since that test did not exist back then (it was added later in rust-lang/rust#144876). I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae92dc added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so we don't need to adjust the compiler flags for it to keep passing.

This PR takes us one step closer to fixing rust-lang/rust#33013.

CC rust-lang/rust#147426 which is related (there will be trivial conflicts for me to resolve in basic-stepping.rs once one of them lands)
2025-11-14 02:12:16 +00:00
ywxt a4d0507af7 Lock shards while collecting active jobs.
Co-authored-by: Zoxc <zoxc32@gmail.com>
2025-11-14 09:01:22 +08:00
Waffle Lapkin fd50a37726 move DispatchFromDyn test out of never_type/
???
2025-11-14 00:04:58 +01:00
Waffle Lapkin b13f49e419 add explanation comments to !-related tests
... outside `tests/ui/never_type/`
2025-11-14 00:04:58 +01:00
Waffle Lapkin 5d33ab1316 fix some typos in !-related test comments 2025-11-14 00:04:54 +01:00
bors 7a72c5459d Auto merge of #148896 - Kobzol:revert-146627, r=madsmtm
Revert "Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann"

This reverts commit 5dc3c19417, reversing
changes made to 11339a0ef5.

Reverts https://github.com/rust-lang/rust/pull/146627 due to a [perf regression](https://github.com/rust-lang/rust/pull/148851#issuecomment-3525797560).

r? `@Zalathar`
2025-11-13 21:15:20 +00:00
bors 2286e5d224 Auto merge of #148481 - GuillaumeGomez:subtree-update_cg_gcc_2025-11-04, r=GuillaumeGomez
Sync rustc_codegen_gcc subtree

cc `@antoyo`

r? ghost
2025-11-13 18:00:02 +00:00
Folkert de Vries ddebb6269f add assembly test for infinite recursion with become 2025-11-13 16:57:02 +01:00
Mara Bos ad1789a5f0 Expose fmt::Arguments::from_str as unstable. 2025-11-13 15:57:51 +01:00
bors af5c5b74c8 Auto merge of #148587 - RalfJung:duration_from_nanos_u128, r=Mark-Simulacrum,oli-obk
stabilize duration_from_nanos_u128

libs-api FCP passed in https://github.com/rust-lang/rust/issues/139201.
Closes https://github.com/rust-lang/rust/issues/139201.

`@oli-obk` would you prefer if we did a const-hack to avoid allowing `const_trait_impl` here?
2025-11-13 14:48:17 +00:00
Guillaume Gomez 044245c6c8 Add regression test for #148008 2025-11-13 15:34:49 +01:00
Guillaume Gomez 101ef2bf81 Correctly link to associated trait items in reexports 2025-11-13 15:34:47 +01:00
Folkert de Vries 78beefed84 error when ABI does not support guaranteed tail calls 2025-11-13 15:31:37 +01:00
Guillaume Gomez 866de5fdcc Ignore tests/ui/lto/lto-global-allocator.rs for GCC backend 2025-11-13 15:23:14 +01:00
Waffle Lapkin abaccaed21 waffle: stop watching codegen ssa 2025-11-13 14:36:17 +01:00
Folkert de Vries 776405c058 add missing s390x target feature to std detect test 2025-11-13 12:46:34 +01:00
Sinan Nalkaya a40c3e5b4b Disable rustdoc-test-builder test partially for SGX target. 2025-11-13 11:53:58 +01:00
bors d682af88a5 Auto merge of #147918 - yotamofek:pr/stringdex-fork, r=GuillaumeGomez
Upgrade `stringdex` to 0.0.3

Includes a bunch of optimizations for a nice perf win
2025-11-13 10:15:39 +00:00
Jakub Beránek ccd87959ed Revert "Rollup merge of #146627 - madsmtm:jemalloc-simplify, r=jdonszelmann"
This reverts commit 5dc3c19417, reversing
changes made to 11339a0ef5.
2025-11-13 10:29:26 +01:00
Yotam Ofek e921e28c7a Upgrade stringdex to 0.0.3 2025-11-13 10:15:30 +02:00
Josh Triplett 199f308446 Guard against incorrect read_buf_exact implementations 2025-11-12 23:12:37 -08:00
Martin Nordholts 5ad2f434dc rustc_codegen_llvm: Require opt-level >= 1 for index-based loop
To make debugger stepping intuitive with `-Copt-level=0`. See the
adjusted `basic-stepping.rs` test.

This is kind of a revert of bd0aae92dc, except we don't revert it,
we just make it conditional on `opt-level`. That commit regressed
`basic-stepping.rs`, but it was not noticed since that test did not
exist back then. I have retroactively bisected to find that out.

It seems messy to sprinkle if-cases inside of the
`write_operand_repeatedly()` so make the whole function conditional.

The test that bd0aae92dc added in
`tests/codegen/issues/issue-111603.rs` already use `-Copt-level=3`, so
we don't need to adjust the compiler flags for it to keep passing.
2025-11-13 06:29:55 +01:00
bors 5dbf4069dc Auto merge of #148885 - Zalathar:rollup-wrvewer, r=Zalathar
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#147701 (rustdoc: don't ignore path distance for doc aliases)
 - rust-lang/rust#148735 (Fix ICE caused by invalid spans for shrink_file)
 - rust-lang/rust#148839 (fix rtsan_nonblocking_async lint closure ICE)
 - rust-lang/rust#148846 (add a test for combining RPIT with explicit tail calls)
 - rust-lang/rust#148872 (fix: Do not ICE when missing match arm with ill-formed subty is met)
 - rust-lang/rust#148880 (Remove explicit install of `eslint` inside of `tidy`'s Dockerfile)
 - rust-lang/rust#148883 (bootstrap: dont require cmake if local-rebuild is enabled)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-13 02:39:06 +00:00
Stuart Cook 314a6cdadf Rollup merge of #148883 - weihanglo:sanity, r=Kobzol
bootstrap: dont require cmake if local-rebuild is enabled

This is for people rebuilding stdlib directly from stage 0 with the full toolchain from rust-src rustup component. The toolchain itself should have sufficient LLVM tools, so CMake and LLVM are not required when `build.local-rebuild = true`

Fixes rust-lang/rust#148835

r? Kobzol
2025-11-13 11:57:11 +11:00
Stuart Cook 3a4a738c9f Rollup merge of #148880 - yotamofek:pr/dockerfile-eslint-install, r=Kobzol,GuillaumeGomez
Remove explicit install of `eslint` inside of `tidy`'s Dockerfile

`tidy` will already install it (when needed) due to it being in `package.json`

With this change, we don't have the version of `eslint` specific in two different places :)

(this was added in rust-lang/rust#141705 , before `tidy` gained the ability to run `npm install`, and is not needed anymore)
2025-11-13 11:57:11 +11:00
Stuart Cook 17c25e4483 Rollup merge of #148872 - ShoyuVanilla:issue-148192, r=chenyukang
fix: Do not ICE when missing match arm with ill-formed subty is met

Fixes rust-lang/rust#148192

The ICE comes from the following line, calling `normalize_erasing_regions` to a projection type whose trait bound is not met:
https://github.com/rust-lang/rust/blob/2fcbda6c1a70606bdb09857e01d01fc6229da712/compiler/rustc_pattern_analysis/src/rustc.rs#L185-L194

The above function is called while trying to lint missing match arms, or scrutinize ctors of missing(not necessary error) match arms.

So, the following code can trigger ICEs.
```rust
trait WhereTrait {
    type Type;
}

fn foo(e: Enum) {
    match e {
        Enum::Map(_) => (), // ICE, while trying to lint missing arms
    }

    if let Enum::Map(_) = e {} // ICE, while trying to scrutinize missing ctors (even worse)
}

enum Enum {
    Map(()),
    Map2(<() as WhereTrait>::Type),
}
```

This ICE won't be triggered with the following code, as this is filtered out before `check_match` as the existence of ill-formed type inside the variant marks the body as tainted by error in `hir_typeck`, but for the above code, the `hir_typeck` complains nothing because everything it sees is locally correct.

```rust
fn foo(e: Enum) {
    match e {
        Enum::Map2(_) => (), // No ICE
    }
}
```

I've considered visiting and wf checking for the match scrutinee before entering `check_match`, but that might regress the perf and I think just emitting delayed bug would enough as the normalization failure would be originated by other errors like ill-formdness.
2025-11-13 11:57:10 +11:00
Stuart Cook 1f2d7db112 Rollup merge of #148846 - folkertdev:tail-call-rpit, r=WaffleLapkin
add a test for combining RPIT with explicit tail calls

tracking issue: https://github.com/rust-lang/rust/issues/112788
fixes https://github.com/rust-lang/rust/issues/139305

Combining return position impl trait (RPIT) with guaranteed tail calls does not currently work, but at least it does not ICE any more.

Using RPIT probably should work, see also https://github.com/rust-lang/rust/issues/144953.

The snippet in the issue is not valid for a variety of reasons, and based on the assert that got triggered the ICE was just any `-> impl Trait` at all, so I've made a minimal example using RPIT.

r? `@WaffleLapkin`
2025-11-13 11:57:09 +11:00
Stuart Cook 20f111f0d8 Rollup merge of #148839 - luca3s:rtsan_ice_fix, r=WaffleLapkin
fix rtsan_nonblocking_async lint closure ICE

Fixes https://github.com/rust-lang/rust/issues/148750, which i introduced in https://github.com/rust-lang/rust/pull/147935.
I also added the bug report to the tests.
2025-11-13 11:57:08 +11:00
Stuart Cook 06b18db01b Rollup merge of #148735 - chenyukang:yukang-fix-ice-148732, r=nnethercote
Fix ICE caused by invalid spans for shrink_file

Fixes rust-lang/rust#148732

There are two issues in this function:
1. the original issue is caused by a typo error, which is fixed in the first commit
2. another different ice(Patch span `7..7` is beyond the end of buffer `0`) will be reported after fixing the first one, is caused by spans cross file boundaries due to macro expansion. It is fixed in the second commit.

r? `@nnethercote`

edited: also fixes rust-lang/rust#148684, added a new testcase for it in the last commit.
2025-11-13 11:57:07 +11:00