Commit Graph

326001 Commits

Author SHA1 Message Date
Jana Dönszelmann 644250d8b6 refactor compute_goal_fast_path: turn into a single match 2026-05-08 10:03:55 +02:00
bors 4ddd4538a8 Auto merge of #154327 - WaffleLapkin:drop_in_place_ref, r=RalfJung,scottmcm,saethlin
change the type of the argument of `drop_in_place` lang item to `&mut _`



We used to special case `core::ptr::drop_in_place` when computing LLVM argument attributes with this hack:

https://github.com/rust-lang/rust/blob/db5e2dc248fe5bb26f70d7baec46a3bca9fa3e1d/compiler/rustc_ty_utils/src/abi.rs#L383-L392

This is because even though `drop_in_place` takes a `*mut T` it is semantically a `&mut T` (remember how `&mut Self` is passed to `Drop::drop`). This is apparently relevant for perf.

This PR replaces this hack with a simpler solution -- it makes `drop_in_place` a thin wrapper around newly added `core::ptr::drop_glue`, which is the actual lang item and takes a `&mut T`:

https://github.com/rust-lang/rust/blob/d2563d5003bbecff1efc40c1f5673ceec603825b/library/core/src/ptr/mod.rs#L810-L833

------

The rest of the PR is blessing tests and cleaning up things which are not necessary after this change.

One thing that is a bit awkward is that now that `drop_glue` is the actual lang item, a lot of the comments referring to `drop_in_place` are outdated. Should I try fixing that?

I've also changed `async_drop_in_place` to take a `&mut T`, and it simplified the code handling it a bit. (since it's unstable we don't need to introduce a wrapper)

-------

cc @RalfJung 
Closes https://github.com/rust-lang/rust/issues/154274
2026-05-07 00:52:53 +00:00
bors a4069f5bd0 Auto merge of #156257 - JonathanBrouwer:rollup-WThya34, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#156251 (stdarch subtree update)
 - rust-lang/rust#156151 (Don't return dummy MacroData in `get_macro`)
 - rust-lang/rust#156211 (tests/ui: allow spaces in hashbrown src normalization)
2026-05-06 21:41:39 +00:00
Jonathan Brouwer 2744cb7ac6 Rollup merge of #156211 - kupiakos:space-in-hashbrown-src-location, r=wesleywiser
tests/ui: allow spaces in hashbrown src normalization

If one's home directory contains a space, the default location for the hashbrown source location also contains a space, and so the UI test normalization in issue-21763 fails to normalize as expected.

While this new regex does not handle all valid paths, such as those beginning with `\\?\` or `\\name\`, this handles most absolute UNIX and Windows paths. Relative paths don't seem to be applicable.
2026-05-06 22:39:20 +02:00
Jonathan Brouwer b1d22623ab Rollup merge of #156151 - mejrs:non_macro_attr, r=petrochenkov
Don't return dummy MacroData in `get_macro`

I was experimenting with tool attributes and ast manipulation, and wasted some time figuring out that this was happening. AFAIK all users of `get_macro` are expecting an actual macro (and none were reading the dummy MacroData) so there should be no change in behavior.
2026-05-06 22:39:20 +02:00
Jonathan Brouwer 04c5b35581 Rollup merge of #156251 - folkertdev:stdarch-sync-2026-05-06, r=folkertdev
stdarch subtree update

Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/6b174ada857fe7547af8b76aaba155d25c630c58.

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

r? @ghost
2026-05-06 22:39:19 +02:00
Folkert de Vries f3773626f0 Merge pull request #2104 from Jamesbarford/remove-inline-always-target-feature
Remove inline always
2026-05-06 18:48:18 +00:00
James Barford-Evans 4c3bde6036 replace more instances of #[inline(always)] 2026-05-06 16:53:04 +01:00
James Barford-Evans a854325c91 remove target_feature_inline_always from lib.rs 2026-05-06 16:39:21 +01:00
James Barford-Evans 13979fcd88 Remove #[inline(always)] from loongarch intrinsic generator & re-generate intrinsics 2026-05-06 16:28:46 +01:00
James Barford-Evans 6169e94e9b Remove #[inline(always)] from hexagon intrinsic generator & re-generate intrinsics 2026-05-06 16:28:26 +01:00
James Barford-Evans 1d2b6ed86b Remove #[inline(always)] from Arm intrinsic generator & re-generate intrinsics 2026-05-06 16:27:55 +01:00
bors 365c0e1d7a Auto merge of #155443 - jdonszelmann:canonical, r=lcnr
Improve caching by introducing `TypingMode::ErasedNotCoherence`



r? @lcnr


This introduces `TypingMode::ErasedNotCoherence`. Most typing modes contain a list of opaque types, which are quite often unused during canonicalization. With this change, any time we try canonicalization, we replace whichever typing mode we're currently in with `ErasedNotcoherence`, attempt to canonicalize, and if that fails *retry* in the original typing mode. If erased mode succeeds, this is beneficial because that way the opaque types don't end up in the cache key, allowing more cache reuse.

This seems to have a small (0.5%) slowdown on most programs, but a dramatic (>60%) speedup in specific cases like the rustc-perf `wg-grammar` benchmark. Some more improvements are expected with "eager normalization", which is work that's under way right now.
2026-05-06 13:55:09 +00:00
mejrs facd03622b Don't return dummy MacroData in get_macro 2026-05-06 14:39:39 +02:00
Waffle Lapkin 94e4ddf127 make NonNull::drop_in_place call drop_glue directly 2026-05-06 13:57:36 +02:00
Waffle Lapkin 278517f345 bless codegen-units tests 2026-05-06 13:57:36 +02:00
Waffle Lapkin af5e1da690 bless mir-opt tests 2026-05-06 13:57:36 +02:00
bors ba1a955819 Auto merge of #156217 - jhpratt:rollup-XVslat0, r=jhpratt
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#151122 (fix: more descriptive error message for enum to integer)
 - rust-lang/rust#155341 (generic_const_args: allow paths to non type consts)
 - rust-lang/rust#156062 (Added command-line argument support for `wasm32-wali-linux-musl`)
 - rust-lang/rust#156159 ([AIX] add -bdbg:namedsects:ss link arg)
 - rust-lang/rust#156174 (Wasm: remove implicit `__heap_base`/`__data_end` exports)
 - rust-lang/rust#156186 (fix: remap ci-llvm debug paths via `-ffile-prefix-map`)
 - rust-lang/rust#156193 (port `rustc_ast*` crates from `box_` to `deref_patterns`)
 - rust-lang/rust#156201 (Don't run ui-fulldeps tests twice in stage 1)
 - rust-lang/rust#155808 (Always use `ConstFn` context for `const` closures)
 - rust-lang/rust#156105 (interpret: correctly deal with repr(transparent) enums)
 - rust-lang/rust#156148 (Use `all_impls` instead of handrolling it)
 - rust-lang/rust#156156 (Adjust getMCSubtargetInfo signature for LLVM 23+)
 - rust-lang/rust#156170 (add known-bug test for coroutine 'static-yields-non-'static unsoundness (rust-lang/rust#144442))
 - rust-lang/rust#156195 (Move tests codegen)
 - rust-lang/rust#156205 (move generalization test)
2026-05-06 10:17:59 +00:00
Amanieu d'Antras 47f942d729 Merge pull request #2096 from sayantn/fix-fixupimm
Fix `fixupimm`
2026-05-06 09:11:53 +00:00
Jana Dönszelmann 36b6eeb66e fixup GenericTypeVisitable 2026-05-06 10:51:32 +02:00
Jana Dönszelmann 1c34c39553 some cleanup 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 52bd834020 move typing mode determination out of canonicalize_goal 2026-05-06 10:18:21 +02:00
Jana Dönszelmann f0c1798a3a prefer assert_not_erased over matching+unreachable 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 8ca4e431ef return ambiguous in fast path, factor out method to check if no opaques in scope 2026-05-06 10:18:21 +02:00
Jana Dönszelmann d543ed8344 make RerunReason an enum 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 13904094c5 some attempts at improving coroutines resulting in FIXME 2026-05-06 10:18:21 +02:00
Jana Dönszelmann e8b74eec74 consistently return OpaquesAccessed from probes to signal why they error 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 9fda7e0c97 Refactor fetch_eligible_assoc_item output 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 7ff71be015 Try to canonicalize with erased opaques, retry when opaques are used. 2026-05-06 10:18:21 +02:00
Jana Dönszelmann a299302d5c Add logging in various places 2026-05-06 10:18:21 +02:00
Jana Dönszelmann 630f0d2bbb type safety for typing mode outside trait solver which can't be erased-not-coherence 2026-05-06 10:18:21 +02:00
Jana Dönszelmann a93f8c0579 Introduce ErasedNotCoherence typing mode 2026-05-06 10:13:29 +02:00
Jana Dönszelmann 6173314a50 Change sg apis to cache opaque accesses 2026-05-06 10:13:29 +02:00
Jana Dönszelmann 3b0a258918 Add AccessedOpaques, tracking opaque access during canonicalization 2026-05-06 10:13:29 +02:00
Jacob Pratt e826e3f3bf Rollup merge of #156205 - lcnr:move-generalization-test, r=lqd
move generalization test

The forth test of https://github.com/rust-lang/trait-system-refactor-initiative/issues/191#issuecomment-3351555279 isn't actually related to closure signature inference.

closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/191, which has already been fixed by https://github.com/rust-lang/rust/pull/155767

r? types
2026-05-05 22:50:27 -04:00
Jacob Pratt f8a77e26f6 Rollup merge of #156195 - danieljofficial:move-tests-codegen, r=JohnTitor
Move tests codegen

Hi, I have moved some tests into the codegen folder
2026-05-05 22:50:27 -04:00
Jacob Pratt 46b1955d9c Rollup merge of #156170 - inq:add-known-bug-test-144442, r=JohnTitor
add known-bug test for coroutine 'static-yields-non-'static unsoundness (#144442)

Add a `known-bug` regression test for [#144442 ("Unsoundness due to 'static coroutines that yield non-'static values").](https://github.com/rust-lang/rust/issues/144442)

Existing known-bug tests:
```
- tests/ui/closures/static-closures-with-nonstatic-return.rs
- tests/ui/implied-bounds/dyn-erasure-tait.rs
- tests/ui/implied-bounds/dyn-erasure-no-tait.rs
```

Verified in Darwin: running the compiled binary segfaults on current main, so the bug is still present.
2026-05-05 22:50:26 -04:00
Jacob Pratt 64b446b190 Rollup merge of #156156 - DKLoehr:subtarget_info, r=cuviper
Adjust getMCSubtargetInfo signature for LLVM 23+

A recent [LLVM PR](https://github.com/llvm/llvm-project/pull/195032) changed the signature of `getMCSubtargetInfo` to return a reference instead of a pointer. This adjusts uses of the function in `compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp` to account for the different signature.
2026-05-05 22:50:25 -04:00
Jacob Pratt 74d6b21eab Rollup merge of #156148 - oli-obk:all_impls, r=lqd
Use `all_impls` instead of handrolling it

just found this while looking at other things
2026-05-05 22:50:25 -04:00
Jacob Pratt 38bbf33d78 Rollup merge of #156105 - RalfJung:transparent-enums, r=lcnr
interpret: correctly deal with repr(transparent) enums

Fixes https://github.com/rust-lang/miri/issues/4998
2026-05-05 22:50:24 -04:00
Jacob Pratt 7eb0a28679 Rollup merge of #155808 - lapla-cogito:issue_155803, r=oli-obk
Always use `ConstFn` context for `const` closures

fixes rust-lang/rust#155803

Since https://github.com/rust-lang/rust/commit/e8a46117795f82f35e2f4087516a8743e28ba174, `hir_body_const_context()` returned the parent's const context for a `const` closure. But a `const` closure can escape its enclosing body via a `fn`-pointer-typed const item or an opaque return type and be invoked at runtime, so it must be const-checked under the most restrictive `ConstFn` context like a regular `const fn`.

r? oli-obk (since you authored the commit mentioned above, feel free to reroll)
2026-05-05 22:50:23 -04:00
Jacob Pratt 2b99e749ac Rollup merge of #156201 - ehuss:no-fulldeps-twice, r=marcoieni
Don't run ui-fulldeps tests twice in stage 1

This removes a separate call in the x86_64-gnu-llvm-21-3 job which runs the ui-fulldeps a second time. ui-fulldeps is already running in the first call (`../x.py --stage 1 test`) as it is a default test suite.

This was added in https://github.com/rust-lang/rust/pull/116009, but I think that was a misunderstanding of the problem. The actual problem was fixed in https://github.com/rust-lang/rust/pull/116932 where the actual problem was the use of `&&`.

This doesn't really have much of an impact on CI time (only a couple seconds) because all the tests are skipped with `ignored, up-to-date`. I'm mainly doing this to clean up the script itself for clarity.
2026-05-05 22:50:23 -04:00
Jacob Pratt d1cdc9b368 Rollup merge of #156193 - cyrgani:unbox-1, r=mejrs
port `rustc_ast*` crates from `box_` to `deref_patterns`

Part of rust-lang/rust#156110, this ports the first few crates away from `box_patterns` to `deref_patterns`.
2026-05-05 22:50:22 -04:00
Jacob Pratt a7587798b5 Rollup merge of #156186 - paradoxicalguy:fix-llvm-debuginfo-remap2, r=Urgau
fix: remap ci-llvm debug paths via `-ffile-prefix-map`

### problem:
ci-llvm include paths leak into debuginfo of `librustc_driver` via C/C++ compilation in `rustc_llvm` , causing non-determinism across two stage2 hermetic builds.

this exhibits as suffixes differing in `anon.*.llvm.<hash>` and mismatched GNU Build IDs, this persists even after stripping the debuginfo.
`remap-debuginfo` does not cover this, it only applies to rustc and not to C/C++ compiler.

### fix:
extend debug path remapping to the C/C++ build in `rustc_llvm` by converting `RUSTC_DEBUGINFO_MAP` into corresponding `-fdebug-prefix-map` flags and passing them through `cc::Build`.

**this is a targeted fix in rustc_llvm; a more general solution would involve propagating remap flags across rustc <-> cargo <-> build scripts.**

r? @Urgau
2026-05-05 22:50:21 -04:00
Jacob Pratt b594ef31e9 Rollup merge of #156174 - daxpedda:wasm-clear-exports, r=alexcrichton
Wasm: remove implicit `__heap_base`/`__data_end` exports

This is kind of a follow-up to rust-lang/rust#147225. Currently `__heap_base`/`__data_end` globals are implicitly exported on `wasm*-unknown-unknown` and `wasm32v1-none`, even though they were only used for Wasm multi-threading, requiring the atomics target feature and shared memory.

Instead users should explicitly opt-in to these features, in which case toolchains, like `wasm-bindgen`, would require some linker flags. After this PR the following would be required for multi-threading support in `wasm-bindgen`:
```
-Clink-arg=--shared-memory -Clink-arg=--max-memory=1073741824 -Clink-arg=--import-memory -Clink-arg=--export=__heap_base -Clink-arg=--export=__wasm_init_tls -Clink-arg=--export=__tls_size -Clink-arg=--export=__tls_align -Clink-arg=--export=__tls_base
```

You will notice that the only new addition is `--export=__heap_base`, apparently `wasm-bindgen` doesn't need `__data_end` anymore (I didn't dig into the original motivation).

---

For context why `wasm-bindgen` needed access to `__heap_base`:
There is currently no mechanism in the Wasm tool conventions that automatically allocates the stack for every thread (e.g. via the `start` function). So `wasm-bindgen` has to explicitly call `malloc` to allocate the stack on the new thread.

However, calling `malloc` itself requires a stack to be present! With the help of `__heap_base` `wasm-bindgen` constructs a temporary stack to make this work. This is obviously quite hacky. A newer implementation could go a different route: e.g. allocate the threads stack in the main thread and passing the right information on, not requiring access to `__heap_base` at all (and avoiding this really messy workaround).

I should also note here that e.g. [`js-bindgen`](https://github.com/wasm-bindgen/js-bindgen), the successor currently being worked on, doesn't need any of these exports because it doesn't rely on post-processing. In which case all of these variables can be accessed by name at link-time, instead of requiring the linker to export each variable for post-processing to find them by name. That is to say: all these workaround are toolchain-specific and not universal to the Wasm targets.

---

r? @alexcrichton
2026-05-05 22:50:21 -04:00
Jacob Pratt 42b7c36a33 Rollup merge of #156159 - daltenty:daltenty/namesects, r=workingjubilee
[AIX] add -bdbg:namedsects:ss link arg

On AIX, the PGO runtime and ifunc runtime support requires the named section linker feature which collects the name sections together and generates start/stop symbols for them.

This change adds the option to the default linker args for the target.
2026-05-05 22:50:20 -04:00
Jacob Pratt 0092af0ee6 Rollup merge of #156062 - arjunr2:wali-support-clargs, r=nia-e
Added command-line argument support for `wasm32-wali-linux-musl`
2026-05-05 22:50:19 -04:00
Jacob Pratt b2cc990df0 Rollup merge of #155341 - khyperia:non-type-const, r=BoxyUwU
generic_const_args: allow paths to non type consts

tracking issue: https://github.com/rust-lang/rust/issues/151972

Non type consts should be usable in the type system in `feature(generic_const_args)`. These are directly plugged into the constant evaluator, unlike type consts, which are attempted to be reasoned about by the type system.

Inherent associated constants are not supported at this time, due to complications around how generic arguments are represented for them (it's currently a mess). The mess is being cleaned up (e.g. https://github.com/rust-lang/rust/pull/154758), so instead of trying to hack support in before the refactoring is done, let's just wait to be able to implement it more cleanly.

r? @BoxyUwU
2026-05-05 22:50:18 -04:00
Jacob Pratt 2717d989c9 Rollup merge of #151122 - Jaidenmagnan:main, r=chenyukang
fix: more descriptive error message for enum to integer

Fixes rust-lang/rust#151116
A  more descriptive error message when casting an enum to an Integer. Please review issue linked above.
2026-05-05 22:50:18 -04:00
Jaiden Magnan 0f5d89fea1 fix: CopyPriority addition 2026-05-05 17:34:50 -04:00