Commit graph

291158 commits

Author SHA1 Message Date
Matthias Krüger
b7150d4e63
Rollup merge of #141943 - nnethercote:rm-pre-expansion-ast-stats, r=compiler-errors
Remove pre-expansion AST stats.

They're very little value, because they only measure the top-level `main.rs` or `lib.rs` file. (Other `.rs` files don't get read and parsed until expansion occurs.)

I saw an example recently where the pre-expansion AST was 3KB in size and the post-expansion AST was 66MB.

I kept the "POST EXPANSION" in the output header, I think that's useful information to avoid possible confusion about when the measurement happens.

r? `@davidtwco`
2025-06-03 21:53:38 +02:00
Matthias Krüger
c8a0f69d0e
Rollup merge of #141925 - cuviper:vestigial-bootstrap, r=workingjubilee
Remove bootstrap cfgs from library/

These `cfg(bootstrap)` are always false now that rust-lang/rust#119899 has landed, and likewise `cfg(not(bootstrap))` is always true. Therefore, we don't need to wait for the usual stage0 bump to clean these up.
2025-06-03 21:53:37 +02:00
Matthias Krüger
f574c0edb5
Rollup merge of #141698 - oli-obk:ctfe-err-flip, r=RalfJung
Use the informative error as the main const eval error message

r? `@RalfJung`

I only did the minimal changes necessary to the const eval error machinery. I'd prefer not to mix test changes with refactorings 😆
2025-06-03 21:53:37 +02:00
Matthias Krüger
644f06ec1f
Rollup merge of #141569 - workingjubilee:canonicalize-abi, r=bjorn3
Replace ad-hoc ABI "adjustments" with an `AbiMap` to `CanonAbi`

Our `conv_from_spec_abi`, `adjust_abi`, and `is_abi_supported` combine to give us a very confusing way of reasoning about what _actual_ calling convention we want to lower our code to and whether we want to compile the resulting code at all. Instead of leaving this code as a miniature adventure game in which someone tries to combine stateful mutations into a Rube Goldberg machine that will let them escape the maze and arrive at the promised land of codegen, we let `AbiMap` devour this complexity. Once you have an `AbiMap`, you can answer which `ExternAbi`s will lower to what `CanonAbi`s (and whether they will lower at all).

Removed:
- `conv_from_spec_abi` replaced by `AbiMap::canonize_abi`
- `adjust_abi` replaced by same
- `Conv::PreserveAll` as unused
- `Conv::Cold` as unused
- `enum Conv` replaced by `enum CanonAbi`

target-spec.json changes:
- If you have a target-spec.json then now your "entry-abi" key will be specified in terms of one of the `"{abi}"` strings Rust recognizes, e.g.
```json
    "entry-abi": "C",
    "entry-abi": "win64",
    "entry-abi": "aapcs",
```
2025-06-03 21:53:36 +02:00
Matthias Krüger
d096ebf8d9
Rollup merge of #141455 - joboet:tls_exhaustion_abort, r=tgross35
std: abort the process on failure to allocate a TLS key

The panic machinery uses TLS, so panicking if no TLS keys are left can lead to infinite recursion (see https://github.com/rust-lang/rust/issues/140798#issuecomment-2872307377). Rather than having separate logic for the panic count and the thread name, just always abort the process if a TLS key allocation fails. This also has the benefit of aligning the key-based TLS implementation with the documentation, which does not mention that a panic could also occur because of resource exhaustion.
2025-06-03 21:53:36 +02:00
Matthias Krüger
27a894f86f
Rollup merge of #137725 - oli-obk:i-want-to-move-it-move-it, r=compiler-errors,traviscross
Add `iter` macro

See related discussion in https://rust-lang.zulipchat.com/#narrow/channel/481571-t-lang.2Fgen/topic/iter!.20macro/near/500784563

very little error case testing so far, but the success path works.

There is also no `IterFn` trait yet, as T-lang didn't consider it something urgently needed I think we can implement it in follow-up PRs.

r? lang for the tests, `@compiler-errors` for the impl
2025-06-03 21:53:35 +02:00
Oli Scherer
5fbdfc3e10
Add iter macro
This adds an `iter!` macro that can be used to create movable
generators.

This also adds a yield_expr feature so the `yield` keyword can be used
within iter! macro bodies. This was needed because several unstable
features each need `yield` expressions, so this allows us to stabilize
them separately from any individual feature.

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
Co-authored-by: Travis Cross <tc@traviscross.com>
2025-06-03 10:52:32 -07:00
Jubilee Young
307a18dc53 compiler: actually remove Conv now that it is irrelevant 2025-06-03 10:08:11 -07:00
Jubilee Young
2351a3e5b4 compiler: simplify TargetOptions ABI functions
`adjust_abi` is not needed and `is_abi_supported` can be a 1-liner.
2025-06-03 10:04:19 -07:00
Jubilee Young
2ad64b4c17 bless test for CanonAbi::X86(SysV64) change 2025-06-03 10:04:19 -07:00
Jubilee Young
9d42e35e8d miri: sed to CanonAbi 2025-06-03 10:04:19 -07:00
Jubilee Young
87fa1ea9d2 cg_gcc: convert to CanonAbi 2025-06-03 10:04:19 -07:00
Jubilee Young
0d8959f48d cg_clif: convert to CanonAbi 2025-06-03 10:04:19 -07:00
Jubilee Young
e0b07a88a3 cg_llvm: convert to CanonAbi 2025-06-03 10:04:19 -07:00
Jubilee Young
72ecde27ff compiler: change Conv to CanonAbi 2025-06-03 10:03:44 -07:00
Jubilee Young
2d637f70a8 compiler: use CanonAbi for entry_abi
makes entry_abi a lowering of the ABI string, so now it can be
```json
  "entry_abi": "C",
  "entry_abi": "win64",
  "entry_abi": "aapcs",
```
2025-06-03 10:02:44 -07:00
Jubilee Young
c04e2490ef compiler: add AbiMap
- Add AbiMapping for encoding the nuance of deprecated ABIs
2025-06-03 09:58:52 -07:00
bors
a124fb3cb7 Auto merge of #141961 - matthiaskrgr:rollup-r09j2sp, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#141724 (fix(rust-lang/rust#141141): When expanding `PartialEq`, check equality of scalar types first.)
 - rust-lang/rust#141833 (`tests/ui`: A New Order [2/N])
 - rust-lang/rust#141861 (Switch `x86_64-msvc-{1,2}` back to Windows Server 2025 images)
 - rust-lang/rust#141914 (redesign stage 0 std follow-ups)
 - rust-lang/rust#141918 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141923 (Update books)
 - rust-lang/rust#141931 (Deconstruct values in the THIR visitor)
 - rust-lang/rust#141956 (Remove two trait methods from cg_ssa)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 16:31:44 +00:00
bors
aae43c4532 Auto merge of #136942 - Kobzol:stage0-sccache, r=jieyouxu
Use ccache for stage0 tool builds

Now after the stage0 redesign, we can actually start ccaching the build of the compiler itself. We can also cache the bootstrap tools, since these are also built with the stage0 compiler.

Stage0 compiler builds are now being cached: https://github.com/rust-lang/rust/actions/runs/15397246267#summary-43321151192 (`..bootstrap::core::build_steps::compile::Rustc	483.10s	40.41s	-91.6%`). It's not a gigantic win everywhere, but it should help. It seems to make the Linux jobs ~10 minute faster. It should be especially useful on PR builds after https://github.com/rust-lang/rust/pull/141948.

r? `@jieyouxu`

try-job: `x86_64-gnu-llvm-19*`
try-job: `x86_64-msvc*`
try-job: `x86_64-apple*`
try-job: `dist-x86_64-linux`
2025-06-03 13:09:57 +00:00
Matthias Krüger
3772a16207
Rollup merge of #141956 - bjorn3:minor_cg_ssa_cleanup, r=oli-obk
Remove two trait methods from cg_ssa

They are only called by cg_llvm.
2025-06-03 15:00:36 +02:00
Matthias Krüger
757d0e70d6
Rollup merge of #141931 - ArtemIsmagilov:issue-141849_2, r=nnethercote
Deconstruct values in the THIR visitor

I continue to add deconstruction for task rust-lang/rust#141849
The changes concern a more complex part of the task `compiler/rustc_hir/src/intravisit.rs`
r? `@nnethercote`
2025-06-03 15:00:36 +02:00
Matthias Krüger
209be9a1d4
Rollup merge of #141923 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

4 commits in 230c68bc1e08f5f3228384a28cc228c81dfbd10d..634724ea85ebb08a542970bf8871ac8b0f77fd15
2025-05-29 13:16:14 UTC to 2025-05-22 21:35:03 UTC

- Chapter 10 from tech review (rust-lang/book#4379)
- Chapter 9 from tech review (rust-lang/book#4377)
- Chapter 8 from tech review (rust-lang/book#4378)
- Chapter 7 from tech review (rust-lang/book#4374)

## rust-embedded/book

3 commits in 0b8219ac23a3e09464e4e0166c768cf1c4bba0d5..10fa1e084365f23f24ad0000df541923385b73b6
2025-05-27 18:37:30 UTC to 2025-05-27 18:26:36 UTC

- portability: add reference to embedded-hal docs (rust-embedded/book#391)
- remove the unused and deprecated `multilingual` field from `book.toml` (rust-embedded/book#388)
- Ci upgrade 20250522 (rust-embedded/book#393)

## rust-lang/nomicon

4 commits in c76a20f0d987145dcedf05c5c073ce8d91f2e82a..8b61acfaea822e9ac926190bc8f15791c33336e8
2025-05-26 10:16:09 UTC to 2025-05-23 15:03:00 UTC

- Use inline const expression in unchecked-uninit.md (rust-lang/nomicon#492)
- Fix code sample output in unchecked-uninit.md (rust-lang/nomicon#491)
- Use consistent type parameters in subtyping.md (rust-lang/nomicon#493)
- Fix typo in atomics.md (rust-lang/nomicon#494)

## rust-lang/reference

1 commits in 118fd1f1f0854f50e3ae1fe4b64862aad23009ca..8e0f593a30f3b56ddb0908fb7ab9249974e08738
2025-05-31 20:12:39 UTC to 2025-05-31 20:12:39 UTC

- Minor fixes to `$crate` behavior (rust-lang/reference#1816)

## rust-lang/rust-by-example

4 commits in c9d151f9147c4808c77f0375ba3fa5d54443cb9e..21f4e32b8b40d36453fae16ec07ad4b857c445b6
2025-05-29 12:45:08 UTC to 2025-05-29 12:44:23 UTC

- Update book.toml rename `author` field to `authors` (rust-lang/rust-by-example#1917)
- Add example to comment.md to teach how to toggle a whole code block using block comments (rust-lang/rust-by-example#1919)
- The example is not meant to be compiled with out passing arguments. (rust-lang/rust-by-example#1930)
- added a shorthand for the #[should_panic(expected = "msg") (rust-lang/rust-by-example#1931)
2025-06-03 15:00:35 +02:00
Matthias Krüger
e61cd1485a
Rollup merge of #141918 - ArtemIsmagilov:issue-141849, r=nnethercote
Deconstruct values in the THIR visitor

Hi! I am a beginner rust developer.
I'm trying to solve your problem rust-lang/rust#141849
I see that 2 files need to be corrected, so I’m starting with a simpler step,  `compiler/rustc_middle/src/thir/visit.rs`

r? `@krikera`
2025-06-03 15:00:35 +02:00
Matthias Krüger
72f60fb700
Rollup merge of #141914 - onur-ozkan:follow-ups, r=Kobzol
redesign stage 0 std follow-ups

Various follow-ups pointed out on Zulip during post-merge discussions of [redesign stage 0 std #119899](https://github.com/rust-lang/rust/pull/119899).

r? `@jieyouxu`

Fixes https://github.com/rust-lang/rust/issues/141902.
Fixes https://github.com/rust-lang/rust/issues/141905.

cc `@jyn514`
2025-06-03 15:00:34 +02:00
Matthias Krüger
5d32b5cad1
Rollup merge of #141861 - jieyouxu:windows-server-2025-20250527, r=Kobzol
Switch `x86_64-msvc-{1,2}` back to Windows Server 2025 images

New Windows Server 2025 images have been released (**20250527.1.0**). New images appear to not exhibit the lack-of-disk-space problem as tracked by rust-lang/rust#141022, and the new runner image's storage capacity appears to be configured correctly.

Windows Server 2025 image version **20250527.1.0** release notes: <https://github.com/actions/runner-images/releases/tag/win25%2F20250527.1>.

Resolves rust-lang/rust#141022.
2025-06-03 15:00:33 +02:00
Matthias Krüger
4fa33eb8d0
Rollup merge of #141833 - Kivooeo:test-reform1, r=jieyouxu
`tests/ui`: A New Order [2/N]

part of rust-lang/rust#133895

r? `@jieyouxu`

let's try this kind of commits, one for each file, commit's name shows what i did, hope this is not harder to review than previous
2025-06-03 15:00:33 +02:00
Matthias Krüger
19437666d9
Rollup merge of #141724 - Sol-Ell:issue-141141-fix, r=nnethercote
fix(#141141): When expanding `PartialEq`, check equality of scalar types first.

Fixes rust-lang/rust#141141.

Now, `cs_eq` function of `partial_eq.rs` compares [scalar types](https://doc.rust-lang.org/rust-by-example/primitives.html#scalar-types) first.

- Add `is_scalar` field to `FieldInfo`.
- Add `is_scalar` method to `TyKind`.
- Pass `FieldInfo` via `CsFold::Combine` and refactor code relying on it.
- Implement `TryFrom<&str>` and `TryFrom<Symbol>` for FloatTy.
- Implement `TryFrom<&str>` and `TryFrom<Symbol>` for IntTy.
- Implement `TryFrom<&str>` and `TryFrom<Symbol>` for UintTy.
2025-06-03 15:00:32 +02:00
ArtemIsmagilov
624e1cde83 Deconstruct values in the THIR visitor 2025-06-03 14:57:11 +04:00
ArtemIsmagilov
ee99fba21d Deconstruct values in the THIR visitor 2025-06-03 14:29:42 +04:00
bjorn3
2e8401ae5f Remove type_test from IntrinsicCallBuilderMethods
It is only used within cg_llvm.
2025-06-03 10:00:56 +00:00
bjorn3
00a88b903d Remove get_dbg_loc from DebugInfoBuilderMethods
It is only used within cg_llvm.
2025-06-03 10:00:11 +00:00
onur-ozkan
59d993b6c7 use better default stage for check::Std when stage isn't explicit
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 12:59:33 +03:00
bors
2f176126aa Auto merge of #141954 - matthiaskrgr:rollup-zptd6t9, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141554 (Improve documentation for codegen options)
 - rust-lang/rust#141817 (rustc_llvm: add Windows system libs only when cross-compiling from Wi…)
 - rust-lang/rust#141843 (Add `visit_id` to ast `Visitor`)
 - rust-lang/rust#141881 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#141898 ([rustdoc-json] Implement PartialOrd and Ord for rustdoc_types::Id)
 - rust-lang/rust#141921 (Disable f64 minimum/maximum tests for arm 32)
 - rust-lang/rust#141930 (Enable triagebot `[concern]` functionality)
 - rust-lang/rust#141936 (Decouple "reporting in deps" from `FutureIncompatibilityReason`)
 - rust-lang/rust#141949 (move `test-float-parse` tool into `src/tools` dir)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 09:51:59 +00:00
Matthias Krüger
2fa33b0624
Rollup merge of #141949 - onur-ozkan:move-test-float-parse, r=Kobzol
move `test-float-parse` tool into `src/tools` dir

Obviously `test-float-parse` is a tool like any other in `src/tools`.

cc `@tgross35`
2025-06-03 11:33:37 +02:00
Matthias Krüger
71009058b0
Rollup merge of #141936 - WaffleLapkin:report-in-deps-decoupling, r=oli-obk
Decouple "reporting in deps" from `FutureIncompatibilityReason`

The reason should just be it -- the reason. It never felt right to me that it was also responsible for whatever we include the warning in cargo's reports.

It gets especially unruly if you want to add non-`FutureReleaseError*` warnings which are included in the reports.

I just added a field to `FutureIncompatibleInfo` to control whatever the diagnostic is included in the cargo's reports.
2025-06-03 11:33:36 +02:00
Matthias Krüger
94da3d9c70
Rollup merge of #141930 - Urgau:triagebot_concern, r=Kobzol
Enable triagebot `[concern]` functionality

Documentation at: https://forge.rust-lang.org/triagebot/concern.html
Example at: https://github.com/rust-lang/triagebot/pull/2024

r? Kobzol
2025-06-03 11:33:36 +02:00
Matthias Krüger
7e8a8c9cb1
Rollup merge of #141921 - ehuss:arm-min-max, r=tgross35
Disable f64 minimum/maximum tests for arm 32

This disables the f64 minimum/maximum tests for the arm-unknown-linux-gnueabihf job. The next release will be supporting cross-compiled doctests, and these tests fail on that platform.

It looks like this was just fixed via https://github.com/llvm/llvm-project/pull/142170, but I assume that will not trickle down to our copy of llvm in the next couple of weeks. Assuming that does get fixed when llvm is updated, then these can be removed.

cc https://github.com/rust-lang/rust/issues/141087
2025-06-03 11:33:35 +02:00
Matthias Krüger
8fbf365f47
Rollup merge of #141898 - LukeMathWalker:patch-1, r=aDotInTheVoid
[rustdoc-json] Implement PartialOrd and Ord for rustdoc_types::Id

This allows consumers to create collections that required an ordering relationship for their keys—e.g. a `BTreeMap`.
2025-06-03 11:33:35 +02:00
Matthias Krüger
1e1e1885a6
Rollup merge of #141881 - lnicola:sync-from-ra, r=lnicola
Subtree update of `rust-analyzer`

r? `@ghost`
2025-06-03 11:33:34 +02:00
Matthias Krüger
ad876cbe86
Rollup merge of #141843 - fee1-dead-contrib:ast_visitor_visit_id, r=oli-obk
Add `visit_id` to ast `Visitor`

This helps with efforts to deduplicate the `MutVisitor` and the `Visitor` code. All users of `Visitor`'s methods that have extra `NodeId` as parameters really just want to visit the id on its own.

Also includes some methods deduplicated and cleaned up as a result of this change.

r? oli-obk
2025-06-03 11:33:33 +02:00
Matthias Krüger
2da4bae07d
Rollup merge of #141817 - mati865:fix-system-libs-when-cross-compiling, r=cuviper
rustc_llvm: add Windows system libs only when cross-compiling from Wi…

…ndows

This obviously doesn't work when cross-compiling from Linux.

Split out from: https://github.com/rust-lang/rust/pull/140772

Fixes the issue described at [#general > Problems while trying to cross compile rustc for windows](https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/Problems.20while.20trying.20to.20cross.20compile.20rustc.20for.20windows/with/520508561)
2025-06-03 11:33:33 +02:00
Matthias Krüger
807778ab78
Rollup merge of #141554 - Noratrieb:document-codegen-opts-better, r=bjorn3
Improve documentation for codegen options

This adds more information to many different codegen options. It should not add any new guarantees, just document existing behavior.

r? bjorn3
2025-06-03 11:33:32 +02:00
onur-ozkan
9505178d50 run x check on mingw-check-2
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 08:51:22 +00:00
onur-ozkan
ecc7dde80a handle stage0 on Std::check
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 08:51:19 +00:00
Waffle Lapkin
9b7da4deb2
decouple "reporting in deps" from future incompatibility reason 2025-06-03 10:49:22 +02:00
onur-ozkan
59fbe04a52 move test-float-parse tool into src/tools dir
Obviously `test-float-parse` is a tool like any other in `src/tools`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 11:05:51 +03:00
onur-ozkan
8a65d9febb make library profile to use stage 1 on x check
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 11:00:33 +03:00
onur-ozkan
4e71f24a6b make x check to use stage0 by default
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2025-06-03 11:00:30 +03:00
bors
c68032fd4c Auto merge of #141944 - matthiaskrgr:rollup-e7xhp6w, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#140715 (Clarify &mut-methods' docs on sync::OnceLock)
 - rust-lang/rust#141677 (Async drop - type instead of async drop fn, fixes rust-lang/rust#140484)
 - rust-lang/rust#141741 (Overhaul `UsePath`)
 - rust-lang/rust#141873 (Fixed a typo in `ManuallyDrop`'s doc)
 - rust-lang/rust#141876 (Don't declare variables in `ExprKind::Let` in invalid positions)
 - rust-lang/rust#141886 (Add missing 2015 edition directives)
 - rust-lang/rust#141889 (Add missing `dyn` keywords to tests that do not test for them)
 - rust-lang/rust#141891 (Fix borrowck mentioning a name from an external macro we (deliberately) don't save)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-06-03 06:34:44 +00:00
Matthias Krüger
f3622ead6e
Rollup merge of #141891 - jdonszelmann:fix-141764, r=jieyouxu
Fix borrowck mentioning a name from an external macro we (deliberately) don't save

Most of the info is already in the title 🤷

Closes rust-lang/rust#141764
2025-06-03 07:03:46 +02:00