Commit Graph

327646 Commits

Author SHA1 Message Date
Jonathan Brouwer fdf56d2cf4 Rollup merge of #156659 - Zalathar:syntax-context, r=oli-obk
coverage: Build the expansion tree around `SyntaxContext`

The expansion tree was previously built around `ExpnId`, which was subtly incorrect in cases where multiple distinct syntax contexts share the same `outer_expn` ID. This can occur in the presence of nested macro expansions.

This change turns out to be fairly straightforward, because in all cases we were obtaining `ExpnId` from `span.ctxt().outer_expn()` anyway, so we can just remove the call to `.outer_expn()` and use the context instead.

As a result of this change, `context-mismatch-issue-147339.rs` no longer triggers a context mismatch in `extract_refined_covspans`, so this PR is a more principled fix for https://github.com/rust-lang/rust/issues/147339.
2026-05-28 10:36:44 +02:00
Jonathan Brouwer 3c533ce81d Rollup merge of #156568 - SergioGasquez:fix/xtensa-vaarg-alg, r=folkertdev
Fix Xtensa vaarg stack transition algorithm

Fixes Xtensa va arg stack transition algorithm
2026-05-28 10:36:43 +02:00
Zalathar 03de21ecc5 coverage: Build the expansion tree around SyntaxContext
The expansion tree was previously built around `ExpnId`, which was subtly
incorrect in cases where multiple distinct syntax contexts share the same
`outer_expn` ID. This can occur in the presence of nested macro expansions.

This change turns out to be fairly straightforward, because in all cases we
were obtaining `ExpnId` from `span.ctxt().outer_expn()` anyway, so we can just
remove the call to `.outer_expn()` and use the context instead.

As a result of this change, `context-mismatch-issue-147339.rs` no longer
triggers a context mismatch in `extract_refined_covspans`.
2026-05-28 12:51:40 +10:00
bors 8f02e856be Auto merge of #157037 - tgross35:update-builtins, r=tgross35
compiler-builtins subtree update

Subtree update of `compiler-builtins` to https://github.com/rust-lang/compiler-builtins/commit/8bf32936feec8c4cca6d56c7ab46c3631d37485c.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-28 01:53:52 +00:00
bors 57d06900fd Auto merge of #157031 - GuillaumeGomez:rollup-FbegncN, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#156970 (coverage: Use original HIR info for synthetic by-move coroutine bodies)
 - rust-lang/rust#157022 (MIR inlining: allow backends to opt-in to inlining intrinsics)
 - rust-lang/rust#157026 (miri subtree update)
 - rust-lang/rust#156390 (Constify Iterator-related methods and functions)
 - rust-lang/rust#156845 (Clarify "infinite size" in cyclic-type diagnostic refers to the type name)
 - rust-lang/rust#156955 (Fix const-eval of shared generic reborrows)
 - rust-lang/rust#156973 (Add uwtable annotation to modules when required)
 - rust-lang/rust#156985 (Limit the additional DLL to Windows)
 - rust-lang/rust#156988 (interpret/validity: properly treat zero-variant enums so that we do not have to check layout.is_uninhabited)
 - rust-lang/rust#157002 (std: Fix thread::available_parallelism on Redox targets)
2026-05-27 19:54:13 +00:00
Guillaume Gomez 7ade8cceb6 Rollup merge of #157002 - willnode:redox-nproc, r=bjorn3
std: Fix thread::available_parallelism on Redox targets

This brings support to `thread::available_parallelism` on Redox targets via `sysconf`. It has been available since `libc 0.2.177` and tested for months.

References:
- [libc implementation](https://github.com/rust-lang/libc/pull/4728)
- [downstream patch](https://gitlab.redox-os.org/redox-os/rust/-/merge_requests/27)
2026-05-27 20:45:16 +02:00
Guillaume Gomez e8d970b08a Rollup merge of #156988 - RalfJung:validate-uninhabited, r=oli-obk
interpret/validity: properly treat zero-variant enums so that we do not have to check layout.is_uninhabited

I am very happy to finally remove the last of these somewhat ad-hoc checks. :)

r? @oli-obk
2026-05-27 20:45:15 +02:00
Guillaume Gomez 3a37aa5765 Rollup merge of #156985 - mati865:additional-llvm-dll-windows-only, r=jieyouxu
Limit the additional DLL to Windows

rust-lang/rust#156229 didn't limit the additional DLL copy to Windows as it was supposed to.
2026-05-27 20:45:14 +02:00
Guillaume Gomez 0846622465 Rollup merge of #156973 - Darksonn:unwind-tables-module, r=nnethercote
Add uwtable annotation to modules when required

When unwind tables are enabled with `-Cforce-unwind-tables=y`, Rust will annotate all functions with the `uwtable` annotation. However, this annotation is missing on modules, which leads to incorrect unwind tables being generated by LLVM for constructors (such as `asan.module_ctor`).

This was discovered because it leads to a crash in Linux when KASAN and dynamic shadow call stack are both enabled. In this scenario, the kernel uses the unwind tables to locate the `paciasp` and `autiasp` instructions in each function and patches the machine code at boot to use the shadow call stack instructions instead. However, LLVM's AArch64PointerAuth pass emits DWARF info for `paciasp` whenever `-g` is passed, but only emits DWARF info for `autiasp` when the `uwtable` attribute is present. Since the `uwtable` annotation is missing for modules, the relevant directives are generated for only the `autiasp` instruction in `asan.module_ctor`, and not for the `paciasp` instruction. This causes the kernel's dynamic SCS logic to patch the prolouge of `asan.module_ctor`, but not the epilogue. This leads to a crash as the shadow call stack becomes unbalanced.

The fact that LLVM doesn't use the same condition for whether to emit DWARF information for both instructions may be a separate bug in LLVM.

Relevant issue: https://github.com/llvm/llvm-project/issues/188234

AI assistance was used to determine the root cause of this crash from the observed symptoms, and to write the tests. Also thanks to @samitolvanen and @maurer for debugging this issue.

Similar to this previous PR of mine: rust-lang/rust#130824
2026-05-27 20:45:14 +02:00
Guillaume Gomez 3e15f828f6 Rollup merge of #156955 - P8L1:fix-reborrow-promotion-consteval, r=RalfJung
Fix const-eval of shared generic reborrows

`Rvalue::Reborrow` const-eval now handles shared generic reborrows produced by `CoerceShared`. Those reborrows intentionally copy from the source ADT into a distinct same-layout target ADT, so the interpreter uses the transmute-capable copy path for `Mutability::Not`.

Promotion is intentionally kept conservative: promotion candidates whose validated temporary graph contains `Rvalue::Reborrow` are rejected, so generic/user-defined reborrows are not promoted.

Fixes rust-lang/rust#156313.
cc @aapoalas
Tracking: rust-lang/rust#145612
@rustbot label F-reborrow
2026-05-27 20:45:13 +02:00
Guillaume Gomez 66ce7b0106 Rollup merge of #156845 - onehr:clarify-cyclic-type-149842, r=JohnTitor
Clarify "infinite size" in cyclic-type diagnostic refers to the type name

Closes rust-lang/rust#149842

The `TypeError::CyclicTy` diagnostic currently emits
"cyclic type of infinite size". As discussed in the issue, "infinite
size" reads as the in-memory `size_of::<T>()` of values, when it
actually refers to the textual representation of the type name (an
iso-recursive occurs-check failure).

This rewords the message so the qualifier "infinite-size" clearly
modifies the *name*, matching the direction `@fmease`, `@BoxyUwU`,
and the issue author converged on:

```
- cyclic type of infinite size
+ recursive type with infinite-size name
```

Nine existing UI `.stderr` baselines and two `//~ NOTE` annotations
are updated to track the new wording. No semantics change.

Tested:
- ./x test tests/ui/const-generics/occurs-check/ tests/ui/closures/ tests/ui/unboxed-closures/ tests/ui/typeck/ tests/ui/coroutine/ --force-rerun
- ./x test tidy
2026-05-27 20:45:12 +02:00
Guillaume Gomez b464e29405 Rollup merge of #156390 - Randl:iter_related_const, r=oli-obk
Constify Iterator-related methods and functions

These functions are required to eventually constify `Iterator`

r? @oli-obk
2026-05-27 20:45:11 +02:00
Guillaume Gomez 1a56fa348e Rollup merge of #157026 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/8d7eac38a9a015913feb364144719c51d3655e2a.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-05-27 20:45:10 +02:00
Guillaume Gomez dc05df7ebe Rollup merge of #157022 - RalfJung:inline-intrinsics-v2, r=oli-obk
MIR inlining: allow backends to opt-in to inlining intrinsics

This is the same as https://github.com/rust-lang/rust/pull/156398. Github stopped processing updates on that other branch.

r? @oli-obk
2026-05-27 20:45:10 +02:00
Guillaume Gomez 1159cb541c Rollup merge of #156970 - qaijuang:async_closure_coverage, r=Zalathar
coverage: Use original HIR info for synthetic by-move coroutine bodies

> This is a copy of #156952(because my git was acting weird)

Synthetic by-move coroutine bodies created for async closures don't have useful HIR of their own. Coverage was falling back to the parent async closure for HIR info, which means the executed `AsyncFnOnce` body could inherit hole spans from the wrong body and report the user-written closure body as uncovered.

This PR uses the synthetic body's coroutine type to recover the original coroutine body def-id, then extracts HIR info from that body instead. That keeps the coverage spans tied to the body the synthetic MIR was cloned from.

Fixes rust-lang/rust#151135.

r? Zalathar
2026-05-27 20:45:09 +02:00
Pieter-Louis Schoeman 56f5c38840 Fix const-eval of shared generic reborrows 2026-05-27 18:17:14 +02:00
Ralf Jung 8cb7db2108 Merge pull request #5060 from WhySoBad/host-io-poll-before-foreign-item
Perform host I/O poll before foreign item invocation
2026-05-27 13:44:07 +00:00
WhySoBad 5d3fc4f39a Process host I/O events before any foreign function invocation
This ensures that the readiness of host-backed file descriptions are
up-to-date before executing a foreign function on it.
2026-05-27 15:17:01 +02:00
Ralf Jung 81c4a78508 Merge pull request #5059 from WhySoBad/network-socket-fix-tests-for-native-hosts
Fix socket tests to run on native host
2026-05-27 13:11:24 +00:00
WhySoBad ac2e825fb5 fix: make socket tests work on native host 2026-05-27 14:40:18 +02:00
Ralf Jung 59428e76e8 MIR inlining: allow backends to opt-in to inlining intrinsics 2026-05-27 13:59:25 +02:00
bors 77a4fb62f7 Auto merge of #155678 - aerooneqq:single-owners-query-exp, r=oli-obk
Merge several HIR-level queries into one



Now four queries (`local_def_id_to_hir_id`, `opt_hir_owner_nodes`, `opt_ast_lowering_delayed_lints`, `in_scope_traits_map`) were replaced with regular methods which acts like getters. 
An `hir_owner` query was added that returns a `ProjectedMaybeOwner` that contains all those fields. `hir_attr_map` remains a separate query as adding attributes to `ProjectedMaybeOwner` led to [perf regressions](https://github.com/rust-lang/rust/pull/155678#issuecomment-4304597871). 
There is a similar issue with `in_scopes_trait_map`, but according to the comments from https://github.com/rust-lang/rustc-perf/pull/2436 it is a rare case.
Most of the changes in incremental tests are renames from `opt_hir_owner_nodes` -> `hir_owner`, but there are few cases when new dirty queries were added.

r? @petrochenkov
r? @oli-obk
2026-05-27 11:45:44 +00:00
Alice Ryhl 90fe8cc66f Adjust UWTableKind comment ref to llvm type 2026-05-27 09:27:35 +00:00
Mateusz Mikuła 12b3dd8a35 Limit the additional DLL to Windows
156229 didn't limit the additional DLL copy to Windows as it was
supposed to.
2026-05-27 11:16:56 +02:00
bors ddc1a64229 Auto merge of #157005 - JonathanBrouwer:rollup-1BZFgyy, r=JonathanBrouwer
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156796 (Fix missing suggestion when matching `String` with `&str`)
 - rust-lang/rust#156933 (rustc_parse_format: improve the error diagnostic for `+` sign flag)
 - rust-lang/rust#156545 (fix issue-144595)
 - rust-lang/rust#156814 (Extend macOS deployment target mismatch filter to cover dylib and new ld formats)
 - rust-lang/rust#156851 (rustdoc: avoid ICE when rendering body-less type consts)
 - rust-lang/rust#156942 (Remove unneeded `#[skip_arg]` attributes)
 - rust-lang/rust#156972 (add field_projections fixme)
 - rust-lang/rust#156975 (Move check_cfg out of diagnostic attr module)
 - rust-lang/rust#156989 (Add missing --set rust.codegen-backends=["gcc"] in the gcc codegen Dockerfile for the core tests)
2026-05-27 08:25:14 +00:00
Jonathan Brouwer a64a3f2075 Rollup merge of #156989 - antoyo:fix/cg_gcc-coretests-ci, r=GuillaumeGomez
Add missing --set rust.codegen-backends=["gcc"] in the gcc codegen Dockerfile for the core tests

The CI would use cranelift instead of the gcc codegen.
This fixes it and was tested in rust-lang/rust#156964.

r? @Kobzol

cc @GuillaumeGomez
2026-05-27 08:14:30 +02:00
Jonathan Brouwer 694ce93540 Rollup merge of #156975 - mejrs:move_check_cfg, r=GuillaumeGomez,JonathanBrouwer
Move check_cfg out of diagnostic attr module

r? @GuillaumeGomez
2026-05-27 08:14:29 +02:00
Jonathan Brouwer 1bc84618a1 Rollup merge of #156972 - lcnr:field_projections-fixme, r=Nadrieril
add field_projections fixme

haven't looked at the code in detail, but I can't see a way in which this is the correct behavior. I think ideally `try_evaluate_added_goals` just doens't return the certainty as afaik it only does so because `evaluate_added_goals_and_make_canonical_response` uses it internally

r? @Nadrieril @BennoLossin
2026-05-27 08:14:29 +02:00
Jonathan Brouwer 241bbc18fc Rollup merge of #156942 - GuillaumeGomez:rm-skip_arg-attrs, r=JonathanBrouwer
Remove unneeded `#[skip_arg]` attributes

@mejrs talked with me about the `Diagnostic` rework that happened recently and suggested that the `skip_arg` might be unneeded. This PR removes all of them, except one. I'll run a perf check to see if it's actually worth keeping around or if we can just remove this attribute altogether (or eventually do the same thing in the proc-macro directly).

cc @JonathanBrouwer

r? ghost
2026-05-27 08:14:28 +02:00
Jonathan Brouwer 03e935f81c Rollup merge of #156851 - reddevilmidzy:mgca-doc, r=GuillaumeGomez
rustdoc: avoid ICE when rendering body-less type consts

close: https://github.com/rust-lang/rust/issues/149287
2026-05-27 08:14:27 +02:00
Jonathan Brouwer aa9d13374b Rollup merge of #156814 - cezarbbb:fix-issue-156714, r=jieyouxu
Extend macOS deployment target mismatch filter to cover dylib and new ld formats

The `deployment_mismatch` filter in `report_linker_output` only matched the old ld64 format for object files. With linker-messages promoted to warn-by-default in rust-lang/rust#153968, unfiltered deployment target warnings from dylibs and the new Apple linker (ld_prime) now surface as noise for users who never set `MACOSX_DEPLOYMENT_TARGET`.

Fixes rust-lang/rust#156714.

At present, the filter works only covered the specific format:

`ld: warning: object file (...) was built for newer 'macOS' version (...) than being linked (...)`

This was fine because linker-messages was `Allow-by-default` — nobody saw the other formats anyway. Then rust-lang/rust#153968 promoted it to Warn, and the gaps became visible.

Broadens the filter to cover all known ld deployment target version mismatch formats:

`ld: warning: object file (...)` — old ld64, already handled
`ld: warning: dylib (...)` — old ld64, was missing
All Apple platforms (`iOS`, `tvOS`, `watchOS`, `xrOS`, etc.), not just `macOS`
`ld: building for <platform>-A.B, but linking with dylib '...' which was built for newer version C.D` — new linker (ld_prime, Xcode 15+), the exact format from rust-lang/rust#156714

All matched messages are downgraded to `linker_info` (Allow-by-default), consistent with the existing behavior for the object file case.
2026-05-27 08:14:26 +02:00
Jonathan Brouwer 806a5186d4 Rollup merge of #156545 - bb1yd:issue-144595, r=mejrs
fix issue-144595

I close the previous PR because it's too messy

relevant issue:rust-lang/rust#144595

I fix this issue by calling `look_ahead` to check if the user write a name field in the tuple struct, then try to recover after calling `parse_ty`
2026-05-27 08:14:26 +02:00
Jonathan Brouwer b0760d1d8e Rollup merge of #156933 - madsravn:wrong-order-more, r=estebank
rustc_parse_format: improve the error diagnostic for `+` sign flag

Added a new parser diagnostic in rustc_parse_format that detects when the `+` sign flag is used without a preceding colon in a format string (e.g., `{+}`) and provides a helpful error message and suggestion to use `{:+}` instead.

r? estebank
2026-05-27 08:14:25 +02:00
Jonathan Brouwer 495657cc2a Rollup merge of #156796 - Kokoro2336:fix/match-str-sugg, r=estebank
Fix missing suggestion when matching `String` with `&str`

Fixes rust-lang/rust#156404

Add suggestion when matching `String` with `&str`
2026-05-27 08:14:24 +02:00
bors 2cfb951a24 Auto merge of #156997 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

13 commits in 4d1f984518c77fad6eeef4f40153b002a659e662..fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef
2026-05-15 17:12:01 +0000 to 2026-05-26 15:08:03 +0000
- fix(compiler): forward verbose flag to rustc for local crates (rust-lang/cargo#17006)
- Fix CVE-2026-5222 and CVE-2026-5223 (rust-lang/cargo#17031)
- Don't use the network for a publish dry-run test  (rust-lang/cargo#17027)
- feat: Break out `RegistryConfig` and `crate_url` for interpreting `RegistryConfig::dl` (rust-lang/cargo#17011)
- refactor(diag): Sort the PARSE_PASS_RULES (rust-lang/cargo#17019)
- fix(artifact)!: Remove compat mode from artifacts (rust-lang/cargo#17016)
- refactor(diag): Simplify adding of new diagnostics (rust-lang/cargo#17015)
- test(package): Mark a network test that timed out on me (rust-lang/cargo#17017)
- refactor(diag): Pull in the parse pass (rust-lang/cargo#17008)
- test(lints): Avoid compiling where possible (rust-lang/cargo#17007)
- fix(diag): Report deferred diagnostics like other diagnostics (rust-lang/cargo#16994)
- refactor: drop `-Zunstable-options` for `rustdoc --emit` (rust-lang/cargo#17002)
- chore(deps): update msrv (1 version) to v1.95 (rust-lang/cargo#17001)
2026-05-27 05:14:22 +00:00
cezarbbb 52bedb4c05 Suppress macOS deployment target linker warnings from ld_prime 2026-05-27 11:32:09 +08:00
Aelin Reidel 628b0b9a50 Upgrade taiki-e/install-action to 2.79.8
This release includes support for ppc64.
2026-05-26 21:51:58 -05:00
Weihang Lo 22929962bb Update cargo submodule 2026-05-26 20:44:39 -04:00
Wildan M 1f02e4d1df std: Fix thread::available_parallelism on Redox targets 2026-05-27 07:39:24 +07:00
bors d1fc603d17 Auto merge of #156385 - RalfJung:tcp-ports, r=nia-e
std::net::tcp: let the OS pick the port numbers



See rust-lang/rust#156377 for context.
I only did the TCP tests for now to see whether there are any unexpected problems.
2026-05-26 19:36:32 +00:00
Antoni Boucher fd0c5f37e7 Add missing --set rust.codegen-backends=["gcc"] in the gcc codegen Dockerfile for the core tests 2026-05-26 15:01:47 -04:00
Ralf Jung e724fa6620 interpret/validity: properly treat zero-variant enums so that we do not have to check layout.is_uninhabited 2026-05-26 20:05:49 +02:00
mejrs a2b21900b4 Move check_cfg out of diagnostic attr module 2026-05-26 17:16:20 +02:00
Alice Ryhl 581bf3c2f9 Add tests for uwtable annotations on modules 2026-05-26 14:43:44 +00:00
lcnr f7c35686aa add field_projections fixme 2026-05-26 16:39:09 +02:00
Alice Ryhl f46fade899 Emit uwtable annotation for modules 2026-05-26 14:32:05 +00:00
Ralf Jung 49972bd6d0 Merge pull request #5042 from WhySoBad/network-socket-read-write-timeout
Add network socket read and write timeout
2026-05-26 14:18:42 +00:00
qaijuang cf3249c0cc coverage: Use original HIR info for synthetic by-move coroutine bodies 2026-05-26 10:01:36 -04:00
qaijuang 78a6b58a42 add red test 2026-05-26 09:57:05 -04:00
Ralf Jung a5e9441e66 Merge pull request #5040 from arpitjain099/chore/sysroots-permissions
ci: declare contents:read on Tier 2 sysroots workflow
2026-05-26 13:50:50 +00:00