Commit Graph

326069 Commits

Author SHA1 Message Date
Nicholas Nethercote 45efffcc4d Rename various things relating to the StableHash derive macros.
Including the `stable_hasher` attribute and the `HashStableMode` enum.

Part of MCP 983.
2026-05-08 15:22:39 +10:00
Nicholas Nethercote fd7da21c53 Rename rustc_macros::hash_stable as stable_hash.
Part of MCP 983.
2026-05-08 15:10:35 +10:00
Nicholas Nethercote 33cd10a881 Rename rustc_data_structures::stable_hasher as stable_hash.
Part of MCP 983.
2026-05-08 15:10:33 +10:00
Nicholas Nethercote 1869ac887d Rename the HashingControls struct as StableHashControls.
Plus two related methods.

Part of MCP 983.
2026-05-08 15:06:09 +10:00
Nicholas Nethercote eab49f5880 Rename the StableHashingContext struct as StableHashState.
Part of MCP 983.
2026-05-08 14:37:21 +10:00
Nicholas Nethercote ad6647f904 Rename the span_hash_stable method as stable_hash_span.
Likewise for the corresponding incremental test.

Part of MCP 983.
2026-05-08 14:37:20 +10: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
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
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
Alex Crichton aadf600574 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 155971
2026-05-06 15:53:24 -07: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
Ramon de C Valle acc33fe5dd 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).
2026-05-06 13:44:04 -07: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
Chayim Refael Friedman ff25d8acf3 Use special DefIds for aliases
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.
2026-05-06 20:56:55 +03: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