Commit Graph

326082 Commits

Author SHA1 Message Date
bjorn3 c2ab95fb61 Handle --print=backend-has-mnemonic in cg_clif
And introduce a has_mnemonic method on CodegenBackend just like
--print=backend-has-zstd
2026-05-08 16:08:56 +02:00
bors 3e353d7353 Auto merge of #156274 - lokirithm:reorg-tests-03, r=wesleywiser
Reorg tests 03

| old-name | new-sub-dir | new-name |
|-|-|-|
| `issue-38727.rs` [issue](https://github.com/rust-lang/rust/issues/38727) | `abi/` | `return-ref-as-immediate-in-codegen.rs` |
| `issue-38437.rs` [issue](https://github.com/rust-lang/rust/issues/38437) | `mir/` | `reset-discriminant-drop-flag-on-partial-move.rs` |
| `issue-31910.rs` [issue](https://github.com/rust-lang/rust/issues/31910) | `associated-consts/` | `associated-const-in-enum-discriminant.rs` |
| `issue-31910.stderr` | `associated-consts/` | `associated-const-in-enum-discriminant.stderr` |
| `issue-48159.rs` [issue](https://github.com/rust-lang/rust/issues/48159) | `packed/` | `packed-c-style-struct.rs` |

r? Kivooeo
2026-05-08 05:02:55 +00:00
bors 63b1dfc0e0 Auto merge of #156290 - JonathanBrouwer:rollup-PNM9rEm, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#156061 (Support `-Cpanic=unwind` on WASI targets)
 - rust-lang/rust#151753 (Experiment: Reborrow traits)
 - rust-lang/rust#156280 (Add regression test for closure return ICE)
 - rust-lang/rust#152487 (core: drop unmapped ZSTs in array `map`)
 - rust-lang/rust#153759 (Add a suite of ChunkedBitSet union/subtract/intersect test scenarios)
 - rust-lang/rust#156198 (Add `sync` option to `-Z threads` to force synchronization on one thread)
2026-05-07 23:03:11 +00:00
Jonathan Brouwer 05c012fff5 Rollup merge of #156198 - Zoxc:threads-sync, r=folkertdev
Add `sync` option to `-Z threads` to force synchronization on one thread

This adds a `sync` option to `-Z threads` to force synchronization while still using one thread. This is useful to measure overhead of synchronization without the noise of additional threads.
2026-05-07 22:44:06 +02:00
Jonathan Brouwer 8e450e52cf Rollup merge of #153759 - Zalathar:chunk-tests, r=wesleywiser
Add a suite of ChunkedBitSet union/subtract/intersect test scenarios

While working on https://github.com/rust-lang/rust/pull/153754, I found that these code paths are under-tested.
2026-05-07 22:44:05 +02:00
Jonathan Brouwer 92dbb8a02b Rollup merge of #152487 - joboet:array_map_zst, r=oli-obk
core: drop unmapped ZSTs in array `map`

Fixes https://github.com/rust-lang/rust/issues/152211.
Alternative to rust-lang/rust#152220 and rust-lang/rust#152248.

This makes the `Drain` type use the same ZST-handling strategy as `slice::IterMut`, which stores the remaining length instead of a one-past-the-end pointer when the type is a ZST. I've also removed the const-generic `N` parameter from `Drain` to avoid unnecessary monomorphizations.
2026-05-07 22:44:05 +02:00
Jonathan Brouwer e56e388df9 Rollup merge of #156280 - TaKO8Ki:issue-155893-closure-return-ice, r=lqd
Add regression test for closure return ICE

Fixes rust-lang/rust#155893
2026-05-07 22:44:04 +02:00
Jonathan Brouwer 96e4153100 Rollup merge of #151753 - aapoalas:aapoalas/reborrow-and-coerce-shared-first-version, r=oli-obk
Experiment: Reborrow traits

With this PR we now have basic functional Reborrow and CoerceShared traits. The current limitations are:

1. Reborrowable types can only have one lifetime parameter, so as to avoid having to figure out and store in rmeta the information of which lifetimes weaken during reborrowing.
2. Reborrowing of `&mut` wrappers is working (though I've not tested generic wrappers like `Option<&mut T>` yet), but CoerceShared of `&mut` wrappers currently causes an ICE.

The remaining tasks to complete before I'd consider this PR mergeable are:

- [x] Fix ICE on CoerceShared. Unfortunately this might require dipping into rmeta.
- [x] Expand the tests to give a more complete view of the current state of the experiment.

Reborrow traits experiment: rust-lang/rust#145612

Co-authored by @dingxiangfei2009
2026-05-07 22:44:03 +02:00
Jonathan Brouwer 71597bc71c Rollup merge of #156061 - alexcrichton:unwinding-onw-asi, r=bjorn3
Support `-Cpanic=unwind` on WASI targets

This commit is some minor updates/restructuring in a few locations with the end result being supporting `-Cpanic=unwind` on WASI targets. This continues to be off-by-default insofar as WASI targets default to `-Cpanic=abort`, meaning that actually using anything in this commit requires `-Zbuild-std`. Specifically the changes made here are:

* The self-contained sysroot for WASI targets now contains a copy of `libunwind.a` from wasi-sdk, first shipped with wasi-sdk-33 (also updated here).
* The `unwind` crate here in this repository uses the `libunwind` module instead of the custom bare-metal wasm implementation of exceptions. This means that Rust uses the `_Unwind_*` symbols which allows it to interoperate with C/C++/etc.
* Wasm targets are all updated to pass the LLVM argument `-wasm-use-legacy-eh=false` to differ from LLVM's/clang's default of using the legacy exception handling proposal for WebAssembly. This has no effect by default because `panic=abort` is used on most targets. Emscripten is exempted from this as the Emscripten target is explicitly intended to follow LLVM's/clang's defaults.
* There's a single test in the test suite that links to the `panic_unwind` crate which ended up requiring `-Wexceptions` from Wasmtime, so the test parts were updated and Wasmtime was updated in CI, too.

The net result of all of this is that this should not actually affect any WebAssembly target's default behavior. Optionally, though, WASI programs can be built with exception handling via:

    RUSTFLAGS='-Cpanic=unwind' cargo +nightly run -Z build-std --target wasm32-wasip2

Effectively `-Zbuild-std` and `-Cpanic=unwind` is all that's necessary to enable this support on wasm targets.

Finally, this ends up closing rust-lang/rust#154593 as well. The WASI targets are now defined to use `-lunwind` to implement unwinding. This means that the in-tree definition of `__cpp_exception` is no longer of concern and the definition is always sourced externally. If Rust is linked with other C/C++ code using WASI then these idioms are compatible with wasi-sdk, for example, to use that as a linker. The main caveat is that when using an external linker the `-fwasm-exceptions` argument needs to be passed to `clang` for it to be able to find the `libunwind.a` library to link against.

Closes rust-lang/rust#154593
2026-05-07 22:44:02 +02:00
Alex Crichton 506693e7d6 Support -Cpanic=unwind on WASI targets
This commit is some minor updates/restructuring in a few locations with
the end result being supporting `-Cpanic=unwind` on WASI targets. This
continues to be off-by-default insofar as WASI targets default to
`-Cpanic=abort`, meaning that actually using anything in this commit
requires `-Zbuild-std`. Specifically the changes made here are:

* The self-contained sysroot for WASI targets now contains a copy of
  `libunwind.a` from wasi-sdk, first shipped with wasi-sdk-33 (also
  updated here).
* The `unwind` crate here in this repository uses the `libunwind` module
  instead of the custom bare-metal wasm implementation of exceptions.
  This means that Rust uses the `_Unwind_*` symbols which allows it to
  interoperate with C/C++/etc.
* Wasm targets are all updated to pass the LLVM argument
  `-wasm-use-legacy-eh=false` to differ from LLVM's/clang's default of
  using the legacy exception handling proposal for WebAssembly. This has
  no effect by default because `panic=abort` is used on most targets.
  Emscripten is exempted from this as the Emscripten target is
  explicitly intended to follow LLVM's/clang's defaults.
* There's a single test in the test suite that links to the
  `panic_unwind` crate which ended up requiring `-Wexceptions` from
  Wasmtime, so the test parts were updated and Wasmtime was updated in
  CI, too.

The net result of all of this is that this should not actually affect
any WebAssembly target's default behavior. Optionally, though, WASI
programs can be built with exception handling via:

    RUSTFLAGS='-Cpanic=unwind' cargo +nightly run -Z build-std --target wasm32-wasip2

Effectively `-Zbuild-std` and `-Cpanic=unwind` is all that's necessary
to enable this support on wasm targets.

Finally, this ends up closing 154593 as well. The WASI targets are now
defined to use `-lunwind` to implement unwinding. This means that the
in-tree definition of `__cpp_exception` is no longer of concern and the
definition is always sourced externally. If Rust is linked with other
C/C++ code using WASI then these idioms are compatible with wasi-sdk,
for example, to use that as a linker. The main caveat is that when using
an external linker the `-fwasm-exceptions` argument needs to be passed
to `clang` for it to be able to find the `libunwind.a` library to link
against.

Closes 154593
2026-05-07 12:51:29 -07:00
bors f964de49bc Auto merge of #149468 - chenyukang:yukang-fix-ice-149278, r=lcnr
Skipping borrowck because of trivial const



r? @saethlin

the [assertion](https://github.com/chenyukang/rust/blob/31c38576a4cf1a0864af536f62d11f829db1c7c8/compiler/rustc_mir_transform/src/lib.rs#L424) is added in PR: https://github.com/rust-lang/rust/pull/148040

I think we also need to skip trvial const in `mir_borrowck`.
2026-05-07 19:45:59 +00:00
Aapo Alasuutari 2d88ee87dd Reborrow traits 2026-05-07 21:55:44 +03:00
bors ffccab6abe Auto merge of #156278 - JonathanBrouwer:rollup-O8O1IcI, r=JonathanBrouwer
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#146273 (lint ImproperCTypes: refactor linting architecture (part 2))
 - rust-lang/rust#154025 (Add `keepalive`, `set_keepalive` to `TcpStream` implementations)
 - rust-lang/rust#156024 (CFI: Fix LTO for `#![no_builtins]` crates with CFI)
 - rust-lang/rust#156243 (Move CrateInfo computation after codegen_crate)
 - rust-lang/rust#154846 (Add better default spans for the `Ty` impl of `QueryKey`)
 - rust-lang/rust#155220 (cg_clif: Don't show verbose run-make cmd output for passing tests)
 - rust-lang/rust#156204 (Implemented `PathBuf::into_string`)
 - rust-lang/rust#156245 (Move invocation_temp into OutputFilenames)
 - rust-lang/rust#156250 (add a few new solver normalization tests)
 - rust-lang/rust#156265 (Remove unused `ToStableHashKey` impls.)
2026-05-07 14:59:29 +00:00
Takayuki Maeda ddddb4d109 add regression test for closure return ICE 2026-05-07 23:33:00 +09:00
yukang 8e1f263f66 Skipping borrowck because of trivial const 2026-05-07 22:18:58 +08:00
Jonathan Brouwer c19565bdfa Rollup merge of #156265 - nnethercote:rm-unused-ToStableHashKey-impls, r=mejrs
Remove unused `ToStableHashKey` impls.

There are quite a few.

r? @mejrs
2026-05-07 14:13:56 +02:00
Jonathan Brouwer 80af49a07f Rollup merge of #156250 - lqd:normalization-tests, r=lcnr
add a few new solver normalization tests

As discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/593097133), this PR adds the handful of new solver revisions and tests from https://github.com/rust-lang/trait-system-refactor-initiative/issues/139. Most cases that issue mentions were already fixed by https://github.com/rust-lang/rust/pull/140672 in 1.88, and some cases, we expect, by https://github.com/rust-lang/rust/pull/155767.

The issue about defaulted type parameters applies to both solvers and will be tracked in https://github.com/rust-lang/rust/issues/156271 instead.

Closes https://github.com/rust-lang/trait-system-refactor-initiative/issues/139.

r? lcnr
I'm not sure where the best place for the tests would be, do you have a better location in mind?
2026-05-07 14:13:55 +02:00
Jonathan Brouwer a48901b65b Rollup merge of #156245 - bjorn3:move_invocation_temp, r=oli-obk
Move invocation_temp into OutputFilenames

While it was previously defined in Session, it is only ever used with OutputFilenames methods.
2026-05-07 14:13:54 +02:00
Jonathan Brouwer 9d7dfa8254 Rollup merge of #156204 - asder8215:pathbuf_into_string, r=nia-e
Implemented `PathBuf::into_string`

Noticed from this [Zulip chat](https://rust-lang.zulipchat.com/#narrow/channel/327149-t-libs-api.2Fapi-changes/topic/.E2.9C.94.20PathBuf.3A.3Ainto_string.3F/with/500962843) that there's been a pretty old [ACP](https://github.com/rust-lang/libs-team/issues/307) on introducing `PathBuf::into_string` that hasn't been implemented yet. I haven't seen anyone link a tracking issue to that [ACP](https://github.com/rust-lang/libs-team/issues/307), so I assume there have been no PRs to complete that ACP.

I made a tracking issue for this ACP [here](https://github.com/rust-lang/rust/issues/156203).
2026-05-07 14:13:54 +02:00
Jonathan Brouwer e61be751b7 Rollup merge of #155220 - jieyouxu:dont-verbose-print-success-cg-clif, r=bjorn3
cg_clif: Don't show verbose run-make cmd output for passing tests

Uses `--verbose-run-make-subprocess-output=false` added in rust-lang/rust#154587 to suppress verbose cmd dump for passing `run-make` tests.

Closes rust-lang/rust#154069.
2026-05-07 14:13:53 +02:00
Jonathan Brouwer ce44b53e77 Rollup merge of #154846 - Zoxc:ty-def-span, r=lcnr
Add better default spans for the `Ty` impl of `QueryKey`

This add default spans for `Ty` in its implementation of `QueryKey`. This is useful so we can get spans for the `layout_of`  query which shows up in cycle errors.
2026-05-07 14:13:52 +02:00
Jonathan Brouwer c5941a03a2 Rollup merge of #156243 - bjorn3:lto_refactors18, r=mu001999
Move CrateInfo computation after codegen_crate

CrateInfo is only necessary during linking and non-local LTO.

Part of https://github.com/rust-lang/compiler-team/issues/908
2026-05-07 14:13:51 +02:00
Jonathan Brouwer 25494215e7 Rollup merge of #156024 - rcvalle:rust-cfi-fix-142284, r=bjorn3
CFI: Fix LTO for `#![no_builtins]` crates with CFI

Fixes LTO for `#![no_builtins]` crates with CFI enabled by using rustc's `EmitObj::Bitcode` path (and emitting LLVM bitcode in the `.o` for linker-based LTO).

It also adds tests that verify that the examples in [rust-cfi-examples](https://github.com/rcvalle/rust-cfi-examples) build and run with `-Zbuild-std` to prevent other future regressions.
2026-05-07 14:13:51 +02:00
Jonathan Brouwer b1a9484b1e Rollup merge of #154025 - yungcomputerchair:keepalive, r=joboet
Add `keepalive`, `set_keepalive` to `TcpStream` implementations

## What
The current implementation of `TcpStream` does not expose `SO_KEEPALIVE`: rust-lang/rust#69774

## Why
It seems the reason this has not yet been implemented is because the initial implementation went as far as to take the keepalive interval as a parameter. However, Windows does not directly expose these intervals for reading, causing there to be some debate about the shape of the API (see the discussion of this [here](https://github.com/rust-lang/rust/pull/31945#issuecomment-189784913)).

## How
I am proposing that this API is enabled with a `bool` parameter to align with the implementation in both Windows and Unix, as it is the least common denominator between the two of them. With regards to the call to `setsockopt`, [Windows expects a disable/enable](https://learn.microsoft.com/en-us/windows/win32/winsock/so-keepalive), and [Unix does as well](https://man7.org/linux/man-pages/man7/socket.7.html).

The extra configuration for Unix that allows the interval to be tweaked could be done through an additional API perhaps, but I don't think that's stopping us from exposing the switch to at least enable the behavior with the OS defaults.

Tracking issue: rust-lang/rust#155889
2026-05-07 14:13:50 +02:00
Jonathan Brouwer 5344306548 Rollup merge of #146273 - niacdoial:improperctypes-refactor2, r=petrochenkov
lint ImproperCTypes: refactor linting architecture (part 2)

This is the second PR in an effort to split https://github.com/rust-lang/rust/pull/134697 (refactor plus overhaul of the ImproperCTypes family of lints) into individually-mergeable parts.

Contains the changes of the first PR, and splits the core type checking function into several bits, each focused on a specific aspect of FFI-safety.
Some logic which was outside of said core function was also moved into the new functions.

Superset of: rust-lang/rust#146271
2026-05-07 14:13:49 +02:00
bors 32bd660612 Auto merge of #156267 - jhpratt:rollup-xaL6466, r=jhpratt
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#156173 (Fewer global node_id_to_def_id lookups)
 - rust-lang/rust#156177 (windows/time: avoid being too close to 0)
 - rust-lang/rust#155961 (Deny warnings in the test for crates that are available on stable)
 - rust-lang/rust#155981 (Use special DefIds for aliases)
 - rust-lang/rust#156130 (Fold/visit tweaks)
 - rust-lang/rust#156131 (Metadata macro/query cleanups)
 - rust-lang/rust#156202 (llvm: Use correct type for splat mask)
 - rust-lang/rust#156223 (Refactor `Type::size` field to `TypeId::size` method for `type_info`)
 - rust-lang/rust#156227 (Add Trusty OS to the generic error implementation.)
 - rust-lang/rust#156237 (compiletest: prevent directives from having multiple revisions)
 - rust-lang/rust#156241 (Move tests coercion)
 - rust-lang/rust#156258 (Document wasi-sdk minimum versions for WASI targets)
2026-05-07 11:51:24 +00:00
Rémy Rakic 130b1d881c move some normalization tests to the dedicated folder 2026-05-07 12:11:55 +02:00
Rémy Rakic 6cc6a63392 add normalization test with defaulted type param with diverging alias
Another example from https://github.com/rust-lang/trait-system-refactor-initiative/issues/139
and which was fixed in 1.89 `nightly-2025-06-18`.
2026-05-07 12:11:55 +02:00
Rémy Rakic 4922210ea6 add normalization test with field with diverging alias
Another example from https://github.com/rust-lang/trait-system-refactor-initiative/issues/139
and which was likely fixed by https://github.com/rust-lang/rust/pull/140672 as well.
2026-05-07 12:11:55 +02:00
Rémy Rakic e2ea0ba07a add new solver revisions to already fixed normalization tests
There were fixed by https://github.com/rust-lang/rust/pull/140672
2026-05-07 12:11:55 +02:00
joboet e8873630a0 core: drop unmapped ZSTs in array map 2026-05-07 11:42:51 +02:00
ujjwalVishwakarma2006 daec39af39 Update files 2026-05-07 14:41:54 +05:30
ujjwalVishwakarma2006 9884ea0c50 Move test files from issues/ to appropriate subdirectories 2026-05-07 14:32:04 +05:30
Jacob Pratt f84a2cd1aa Rollup merge of #156258 - alexcrichton:update-some-docs, r=jieyouxu
Document wasi-sdk minimum versions for WASI targets

This commit updates the documentation for WASI targets in the rustc book to mention a minimum version of wasi-sdk that's required.

Closes rust-lang/rust#155971
2026-05-07 02:12:15 -04:00
Jacob Pratt 3d841c1702 Rollup merge of #156241 - danieljofficial:move-tests-coercion, r=Kivooeo
Move tests coercion

Hi, I have moved some tests that belong in the coercion folder. Please take out time to review
r? @Kivooeo
2026-05-07 02:12:15 -04:00
Jacob Pratt 6fa435d83c Rollup merge of #156237 - lqd:compiletest-revisions, r=wesleywiser,jieyouxu
compiletest: prevent directives from having multiple revisions

Right now, a compiletest directive like `//@ [foo,bar] compile-flags: -Z hello` is accepted. While it looks similar to a `//[foo,bar]` error annotation matching multiple revisions, it will instead model a directive for a single revision named `foo,bar` and not for two revisions. Slightly inconsistent/confusing.

I don't know that it's common enough to make bigger changes to support it fully (`miri`'s test harness seems to support that use-case), but since I hit that today, this PR prevents that case for now. Otherwise, I think we'd have to turn all uses of `line_directive` as possibly creating multiple line directives, one per revision, etc.

Such a directive will now yield an error, with a best-effort suggestion to split it into multiple single-revision directives:

```
multiple revisions aren't supported yet in `//@ [foo,bar] compile-flags: -Z hello`, split them like
//@ [foo]: compile-flags: -Z hello
//@ [bar]: compile-flags: -Z hello
```
2026-05-07 02:12:14 -04:00
Jacob Pratt 99e0e37a2a Rollup merge of #156227 - chaos2007:main, r=jhpratt,randomPoison
Add Trusty OS to the generic error implementation.

Background:
* During this refactor, the Trusty OS was not targeted in the cfg_select: https://github.com/rust-lang/rust/commit/e259373ce9eca5a10201d74a016a4a2e7ab42ed7

r? @randomPoison
2026-05-07 02:12:13 -04:00
Jacob Pratt 44ce9e7758 Rollup merge of #156223 - SpriteOvO:type-info-refactor-size, r=oli-obk
Refactor `Type::size` field to `TypeId::size` method for `type_info`

Tracking issue rust-lang/rust#146922

r? @oli-obk
2026-05-07 02:12:12 -04:00
Jacob Pratt e6fac7e506 Rollup merge of #156202 - maurer:splat, r=nikic
llvm: Use correct type for splat mask

After llvm/llvm-project#195486 , LLVM has explicit handling for null pointers in simd operations instead of using special handling based on zeroes.

This causes LLVM with asserts enabled to detect an improperly typed mask passed to splat (if the output vector does not have i32 elements), and can cause SIGSEGV in more complex cases with asserts disabled.

@rustbot label: +llvm-main

r? @durin42
2026-05-07 02:12:12 -04:00
Jacob Pratt 2aadc4a53c Rollup merge of #156131 - nnethercote:rm-unnecessary-decode, r=Zalathar
Metadata macro/query cleanups

Details in individual commits.

r? @Zalathar
2026-05-07 02:12:11 -04:00
Jacob Pratt 2bc8e5e03f Rollup merge of #156130 - nnethercote:fold-visit-tweaks, r=WaffleLapkin
Fold/visit tweaks

Details in individual commits.

r? @WaffleLapkin
2026-05-07 02:12:10 -04:00
Jacob Pratt b320b56fb9 Rollup merge of #155981 - ChayimFriedman2:alias-def-id, r=lcnr
Use special DefIds for aliases

Renewal of https://github.com/rust-lang/rust/pull/155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
2026-05-07 02:12:10 -04:00
Jacob Pratt 70c1afd981 Rollup merge of #155961 - jdonszelmann:deny-warnings-stable, r=mejrs
Deny warnings in the test for crates that are available on stable

We've got a couple of crates, like `rustc_type_ir` that have parts disabled on stable. I believe part of this is so, for example, rust-analyzer can use bits of the compiler. We previously allowed warnings here, and I ran into one. This denies warnings in the test that compiles these stable crates (I chose not to on the crate itself, so you don't *constantly* run into the warnings if you have turned that off in `config.toml`). This test doesn't run by default, but it does run in CI.
2026-05-07 02:12:09 -04:00
Jacob Pratt 746ea544ae Rollup merge of #156177 - RalfJung:windows-time-epoch, r=ChrisDenton
windows/time: avoid being too close to 0

Fixes https://github.com/rust-lang/rust/issues/156142 (but only for Windows -- should we still track it for non-tier-1-platforms?)
2026-05-07 02:12:08 -04:00
Jacob Pratt ac468d573b Rollup merge of #156173 - oli-obk:fewer-global-lookups, r=petrochenkov
Fewer global node_id_to_def_id lookups

Several of these are unnecessary if we track the `LocalDefId` together with the `NodeId`. We can't remove the `NodeId` entirely, as it is needed for lints, but it's a useful refactoring for splitting node_id_to_def_id into a per-owner table in the future

r? @petrochenkov
2026-05-07 02:12:07 -04:00
bors 0e5924a4a0 Auto merge of #149509 - mu001999-contrib:flag/pub-as-pub-crate, r=jdonszelmann
Lint unused pub items in binary crates



~~This PR adds a new unstable flag -Ztreat-pub-as-pub-crate as [@Kobzol](https://github.com/Kobzol) suggested.~~
~~When compiling binary crates with this flag, the seed worklist will only contain the entry fn and won't contain other reachable items. Then we can do the dead code analysis for pub items just like they are pub(crate).~~

Related zulip thread [#general > pub/pub(crate) within a binary is a footgun](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/pub.2Fpub.28crate.29.20within.20a.20binary.20is.20a.20footgun/with/558931034).

---

Updated:

Adds a new lint `unused_pub_items_in_binary` (crate-level, default allow for now) instead of the previous unstable flag to lint unused `pub` items for binary crates.

See more details of implementation in https://github.com/rust-lang/rust/pull/149509#issuecomment-4102337689.

This lint is allowed by default, but I believe this has been better than the unstable flag. Making it warn-by-default will lead to a lot of noise for this PR (like bless many tests). So I'd like to make it warn-by-default in a separate PR in the future.
2026-05-07 05:38:32 +00:00
Asuna f7649e7c4b Rename and move downcast to project_downcast_named for InterpCx 2026-05-07 04:43:21 +00:00
Nicholas Nethercote 769f2f16fe Remove unused ToStableHashKey impls.
There are quite a few.
2026-05-07 14:41:12 +10: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
John Kåre Alsaker 8aafed8a17 Add sync option to -Z threads to force synchronization on one thread 2026-05-07 02:06:18 +02:00