Commit graph

315669 commits

Author SHA1 Message Date
Weihang Lo
500c94f945
Update cargo submodule 2026-01-16 15:45:53 -05:00
bors
503745e917 Auto merge of #151210 - matthiaskrgr:rollup-JwDAUuv, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#145354 (Cache derive proc macro expansion with incremental query)
 - rust-lang/rust#151123 (Support primitives in type info reflection)
 - rust-lang/rust#151178 (simplify words initialization using Rc::new_zeroed)
 - rust-lang/rust#151187 (Use `default_field_values` more in `Resolver`)
 - rust-lang/rust#151197 (remove lcnr from compiler review rotation)
 - rust-lang/rust#151203 (Revert `QueryStackFrame` split)

r? @ghost
2026-01-16 16:44:08 +00:00
bors
b08c11df4b Auto merge of #151162 - GuillaumeGomez:cleanup-attr-parsing, r=JonathanBrouwer
Clean up `rustc_attr_parsing`

Follow-up of rust-lang/rust#150934.

It removes the `Option<>` wrapping for `SharedContext::target` field and completely removed the `target_id` field. Considering this type contains a closure and never updates its `target_id` field, there is no need to keep it around, it can be used directly in the lint emitter.

r? @JonathanBrouwer
2026-01-16 13:03:57 +00:00
Matthias Krüger
57e950bc98
Rollup merge of #151203 - revert-QueryStackFrame-split, r=oli-obk
Revert `QueryStackFrame` split

PR rust-lang/rust#138672 fixed a query cycle OOM reported in rust-lang/rust#124901. The fix involved delaying computation of some query stack frame elements and was very complex. It involved the addition of two new types, the addition of a generic `I` parameter to eleven(!) other types, a `PhantomData` field, and even required an unsafe transmute of a closure. [This comment](https://github.com/rust-lang/rust/issues/124901#issuecomment-2104852065) had suggested a much simpler fix, but it was ignored. The PR also failed to add a test case.

This PR adds a test case, reverts the complex fix, applies the simpler fix, and does a few other minor cleanups.

r? @oli-obk
2026-01-16 13:57:47 +01:00
Matthias Krüger
712a178d9f
Rollup merge of #151197 - no-more-reviews, r=lqd
remove lcnr from compiler review rotation

Have been feeling somewhat swamped by review and mentoring work and want to focus my review time on involved type system changes. I am very much available to review specific changes, but don't want to be auto-assigned to general compiler changes.
2026-01-16 13:57:47 +01:00
Matthias Krüger
771fa1c0f1
Rollup merge of #151187 - const-resolver, r=petrochenkov
Use `default_field_values` more in `Resolver`

Extend more ways of building `FxHashSet`, `FxHashMap`, `UnordSet`, `UnordMap` and `DisambiguatorState` in `const` contexts to allow for more fields in `Resolver` to have a default value. `FxIndexSet`/`FxIndexMap` are still outstanding and not const-buildable.

r? @petrochenkov
2026-01-16 13:57:47 +01:00
Matthias Krüger
4227404a04
Rollup merge of #151178 - ua/fixme, r=Kivooeo
simplify words initialization using Rc::new_zeroed

Now that Rc::new_zeroed is stable, remove the cfg(feature = "nightly") branch and the temporary zeroed array on stable. This avoids copying a potentially large [Word; CHUNK_WORDS] into the Rc.
2026-01-16 13:57:46 +01:00
Matthias Krüger
225ba69ee2
Rollup merge of #151123 - type-info-primitives, r=oli-obk
Support primitives in type info reflection

Tracking issue: rust-lang/rust#146922 `#![feature(type_info)]`

This PR supports {`bool`,`char`,`int`,`uint`,`float`,`str`} primitive types for feature `type_info` reflection.

r? @oli-obk
2026-01-16 13:57:46 +01:00
Matthias Krüger
81cc29a425
Rollup merge of #145354 - cache-proc-derive-macros, r=petrochenkov
Cache derive proc macro expansion with incremental query

This is a revival of https://github.com/rust-lang/rust/pull/129102, originally implemented by @futile. Since it looks like they are not active currently, I'd like to push this work forward.

The first commit is squashed and rebased work from the original PR, with author attribution to futile. The rest of the commits are some additional comments that I created mostly for myself to understand what happens here. I also did some cleanups based on Vadim's review comments on the original PR, plus I refactored the TLS access a bit using `scoped_tls`.

The biggest issue, as usually, are tests... I tried using `#[rustc_clean(..., loaded_from_disk = "derive_macro_expansion")]`, but the problem is that since this query cannot recover the original key from its hash, and thus its fingerprintstyle is `FingerprintStyle::Opaque`, [this](2fef0a30ae/compiler/rustc_incremental/src/persist/dirty_clean.rs (L388)) crashes when I try to use `loaded_from_disk`. Any suggestions from someone who actually understands the query system would be welcome 😅

TODO: document the new unstable flag

On a no-op change re-check of `octocrab 0.49` (which has a ton of `serde` derive proc macro invocations), this saves ~0.6s out of ~6s (so a ~10% win) on my PC.

r? @petrochenkov
2026-01-16 13:57:45 +01:00
bors
c40c51f9fd Auto merge of #151193 - matthiaskrgr:rollup-17r4zye, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#151166 (fix: Do not delay E0107 when there exists an assoc ty with the same name)
 - rust-lang/rust#151185 (Disable `dump-ice-to-disk` on `i686-pc-windows-msvc`)

r? @ghost
2026-01-16 09:47:11 +00:00
lcnr
db36c093ca remove lcnr from compiler review rotation 2026-01-16 10:21:06 +01:00
Nicholas Nethercote
90e4a42162 Use with_reduced_queries to avoid query cycles.
This changes the error message of `query-cycle-issue-124901.rs`, which
doesn't matter much.
2026-01-16 19:21:35 +11:00
Nicholas Nethercote
48bcaf7ed1 Revert the QueryStackFrameExtra/QueryStackDeferred split.
PR #138672 introduced a complex and invasive split of `QueryStackFrame`
to avoid a query cycle. This commit reverts that change because there is
a much simpler change that fixes the problem, which will be in the next
commit.
2026-01-16 19:18:42 +11:00
Matthias Krüger
6e49b64c49
Rollup merge of #151185 - disable-dump-ice-i686, r=dianqk
Disable `dump-ice-to-disk` on `i686-pc-windows-msvc`

Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on `i686-pc-windows-msvc` which then makes this test flaky. Noticed in https://github.com/rust-lang/rust/pull/150925#issuecomment-3754504924.

Originally expanded in rust-lang/rust#142563 to see if it's still flaky for other `*-windows-*` targets, unfortunately the answer is yes for `i686-pc-windows-msvc` as well.

r? @dianqk (or compiler or anyone really)
2026-01-16 08:03:59 +01:00
Matthias Krüger
0cfe78fa1f
Rollup merge of #151166 - issue-148121, r=tiif
fix: Do not delay E0107 when there exists an assoc ty with the same name

Fixes rust-lang/rust#148121

When we have the following code:

```rust
trait Foo<T> {}

impl Foo<T: Default> for String {}
```

we delay `E0107: wrong number of generic args` to suggest moving `T: Default` bound to the impl block's param declaration.

The delay is determined by whether all the missing generic parameters are mentioned by those *wrong* assoc item constraints.

But this delay is wrong when there exist any *correct* assoc item constraints, i.e. when we have an assoc type whose identifier is same with a missing generic parameter like in the following code:

```rust
pub trait Super<X> {
    type X;
}
pub trait A {}
impl A for dyn Super<X = ()> {}
```
2026-01-16 08:03:59 +01:00
Felix Rath
8fa2f693bb
Implement incremental caching for derive macro expansions 2026-01-16 07:36:36 +01:00
bors
d2015e2359 Auto merge of #151155 - Zalathar:str, r=Nadrieril
THIR patterns: Always use type `str` for string-constant-value nodes

Historically, constants and literals of type `&str` have been represented in THIR patterns as `PatKind::Const` nodes with type `&str`.

That's fine for stable Rust, but `feature(deref_patterns)` also created a need to have string literal patterns of type `str` in some cases, which resulted in a number of additional special cases and inconsistencies in typechecking and in HIR-to-THIR-to-MIR lowering of patterns.

We can avoid several of those special cases by having THIR treat string-constant-values as fundamentally being of type `str`, and then using `PatKind::Deref` to represent the additional `&` layer in the common case where it is needed. This allows bare `str` patterns to require very little special treatment.

Existing tests should already do a good job of demonstrating that this implementation change does not affect the stable language.
2026-01-16 06:30:36 +00:00
Nicholas Nethercote
2e58d05a0a Add test from #124901.
Issue #124901 was an OOM caused by a query cycle. It was fixed by
a complex change in PR #138672, but that PR did not add the test case.
Let's add it now, because it's the only known reproducer of the OOM.
2026-01-16 16:41:35 +11:00
Nicholas Nethercote
4c2e447027 Rename fatal_cycle as cycle_fatal.
To be consistent with the closely related `cycle_stash` and
`cycle_delay_bug`.
2026-01-16 14:55:03 +11:00
Nicholas Nethercote
9f6e7473d6 Fix a typo. 2026-01-16 14:54:20 +11:00
bors
bcf787a780 Auto merge of #151183 - jhpratt:rollup-GxmJbns, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#150607 (Add amdgpu_dispatch_ptr intrinsic)
 - rust-lang/rust#150611 (Unify and deduplicate From<T> float tests)
 - rust-lang/rust#151082 (Silence unused type param error on struct parse error)
 - rust-lang/rust#151159 (Tidying up `tests/ui/issues` 15 tests [8/N])
 - rust-lang/rust#151164 (Stabilise `EULER_GAMMA` and `GOLDEN_RATIO` constants for `f32` and `f64`.)

r? @ghost
2026-01-16 03:11:31 +00:00
Esteban Küber
2b139b786e prelude is already defaulted 2026-01-16 02:38:18 +00:00
Esteban Küber
664e19bc3a Make DisambiguatorState const-buildable 2026-01-16 02:38:18 +00:00
Esteban Küber
dd4d60f701 Provide default field in Resolver for NodeMap fields 2026-01-16 02:38:18 +00:00
Esteban Küber
2766ccfd4e Make UnordSet and UnordMap const Default and use it in Resolver 2026-01-16 02:38:18 +00:00
Esteban Küber
bfd1a9a86f Use default_field_values more in Resolver
Provide `const` functions to get around lack of `const Default` for `FxHash*` types.

Use default field values in `Resolver` more.
2026-01-16 02:38:17 +00:00
Jieyou Xu
8dfb888812
Disable dump-ice-to-disk on i686-pc-windows-msvc
Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on
`i686-pc-windows-msvc` which then makes this test flaky.
2026-01-16 09:27:45 +08:00
Zalathar
e673bf57c2 Also remove pat_ty from TestKind::ScalarEq 2026-01-16 12:21:48 +11:00
Zalathar
066eb6d2ea THIR patterns: Always use type str for string-constant-value nodes 2026-01-16 12:17:48 +11:00
Zalathar
02c5f9a5b4 Add a snapshot test for string patterns in THIR 2026-01-16 12:17:47 +11:00
Jacob Pratt
c3120ff03a
Rollup merge of #151164 - euler-gamma-golden-ratio, r=jhpratt
Stabilise `EULER_GAMMA` and `GOLDEN_RATIO` constants for `f32` and `f64`.

Tracking issue: rust-lang/rust#146939

This PR renames the `EGAMMA` and `PHI` constants to `EULER_GAMMA` and `GOLDEN_RATIO` – respectively – and stabilises them under these names for `f32` and `f64`:

```rust
// core::f16::consts

pub const GOLDEN_RATIO: f16;

pub const EULER_GAMMA: f16;

// core::f32::consts

pub const GOLDEN_RATIO: f32;

pub const EULER_GAMMA: f32;

// core::f64::consts

pub const GOLDEN_RATIO: f64;

pub const EULER_GAMMA: f64;

// core::f128::consts

pub const GOLDEN_RATIO: f128;

pub const EULER_GAMMA: f128;
```

The feature gate for the stabilised items is also changed to `euler_gamma_golden_ratio`.
2026-01-15 19:35:48 -05:00
Jacob Pratt
8790d2640d
Rollup merge of #151159 - t15, r=Kivooeo
Tidying up `tests/ui/issues` 15 tests [8/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

There are some tests named {xxx}-2, which are meant to be merged with {xxx}.

r? Kivooeo
2026-01-15 19:35:47 -05:00
Jacob Pratt
23f6cb5f12
Rollup merge of #151082 - issue-141403, r=Kivooeo
Silence unused type param error on struct parse error

Given

```
#[derive(Clone)]
struct B<T> {
    a: A<(T, u32)> // <- note, comma is missing here
    /// asdf
    b: u32,
}
```

do not emit unnecessary "unused `T`" error.

Fix rust-lang/rust#141403.
2026-01-15 19:35:47 -05:00
Jacob Pratt
0cef925c52
Rollup merge of #150611 - from-bool-float-test, r=tgross35
Unify and deduplicate From<T> float tests

cc rust-lang/rust#141726

Unify the From<bool> tests from f16.rs and f128.rs into a single float_test! in mod.rs.
2026-01-15 19:35:46 -05:00
Jacob Pratt
6912c676cd
Rollup merge of #150607 - dispatch-ptr-intrinsic, r=workingjubilee
Add amdgpu_dispatch_ptr intrinsic

There is an ongoing discussion in rust-lang/rust#150452 about using address spaces from the Rust language in some way.
As that discussion will likely not conclude soon, this PR adds one rustc_intrinsic with an addrspacecast to unblock getting basic information like launch and workgroup size and make it possible to implement something like `core::gpu`.

Add a rustc intrinsic `amdgpu_dispatch_ptr` to access the kernel dispatch packet on amdgpu.
The HSA kernel dispatch packet contains important information like the launch size and workgroup size.

The Rust intrinsic lowers to the `llvm.amdgcn.dispatch.ptr` LLVM intrinsic, which returns a `ptr addrspace(4)`, plus an addrspacecast to `addrspace(0)`, so it can be returned as a Rust reference.
The returned pointer/reference is valid for the whole program lifetime, and is therefore `'static`.
The return type of the intrinsic (`&'static ()`) does not mention the struct so that rustc does not need to know the exact struct type. An alternative would be to define the struct as lang item or add a generic argument to the function.
Is this ok or is there a better way (also, should it return a pointer instead of a reference)?

Short version:
```rust
#[cfg(target_arch = "amdgpu")]
pub fn amdgpu_dispatch_ptr() -> *const ();
```

Tracking issue: rust-lang/rust#135024
2026-01-15 19:35:46 -05:00
bors
18ae990755 Auto merge of #150925 - dianqk:if-cmp, r=saethlin
Only use SSA locals in SimplifyComparisonIntegral

Fixes https://github.com/rust-lang/rust/issues/150904.

The place may be modified from the comparison statement to the switchInt terminator.

Best reviewed commit by commit.
2026-01-15 23:54:21 +00:00
Usman Akinyemi
0dc5b52e8e simplify words initialization using Rc::new_zeroed
Now that Rc::new_zeroed is stable, remove the cfg(feature = "nightly")
branch and the temporary zeroed array on stable. This avoids copying a
potentially large [Word; CHUNK_WORDS] into the Rc.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-01-16 04:25:12 +05:30
Asuna
b2a7b18ec4 Merge type info variant Uint into Int 2026-01-15 23:04:40 +01:00
Asuna
5c057ad896 Remove their own TypeId from type info for primitives 2026-01-15 22:58:39 +01:00
reddevilmidzy
77b2a196fb cleaned up some tests
merge privacy/privacy-sanity-2 with privacy/privacy-sanity.rs

Add comment to generics/type-args-on-module-in-bound.rs

Add comment to array-slice-vec/closure-in-array-eln.rs

Add comment to array-slice-vec/return-in-array-len.rs

Merge for-loop-while/break-outside-loop-2.rs with
for-loop-while/break-outside-loop.rs

Add comment to macros/column-macro-collision.rs

Add comment to privacy/private-extern-fn-visibility.rs

Add comment to mismatched_types/vec-hashset-type-mismatch.rs

Merge std-sync-right-kind-impls-2.rs with std-sync-right-kind-impls.rs

Add comment to array-slice-vec/slice-of-multi-ref.rs

Add comment to mismatched_types\vec-hashset-type-mismatch.rs

Add comment to derives/derive-hygiene-struct-builder.rs

Add comment to label/undeclared-label-span.rs

Add comment to label\undeclared-label-span.rs

Add comment to mismatched_types/array-repeat-unit-struct.rs
2026-01-16 06:50:34 +09:00
reddevilmidzy
559e672489 move some tests 2026-01-16 06:50:21 +09:00
Esteban Küber
9750d22c17 Silence unused type param and inference errors on struct parse error 2026-01-15 21:16:48 +00:00
bors
22c74ba918 Auto merge of #151056 - mejrs:do_not_recommend, r=JonathanBrouwer
Port `diagnostic::do_not_recommend` to new attr parsing

r? @jdonszelmann
2026-01-15 19:35:19 +00:00
bors
b5c2a0fc0a Auto merge of #150982 - petrochenkov:modsplitfast2, r=JonathanBrouwer
resolve: In `visit_scopes` do not extract ctxt out of span unless necessary

This recovers the second half of perf regressions from https://github.com/rust-lang/rust/pull/149681 (the first part was recovered in https://github.com/rust-lang/rust/pull/150741).
2026-01-15 16:16:17 +00:00
Shoyu Vanilla
08362d3e51 fix: Do not delay E0107 when there exists an assoc ty with the same name 2026-01-16 00:35:10 +09:00
Gabriel Bjørnager Jensen
6cd43592a8
Stabilise 'EULER_GAMMA' and 'GOLDEN_RATIO' constants; 2026-01-15 16:19:57 +01:00
Guillaume Gomez
820579243f Remove rustc_attr_parsing::SharedContext::target_id field 2026-01-15 15:39:00 +01:00
Guillaume Gomez
cd7d40d975 Update rustc_attr_parsing::SharedContext::target type from Option<Target> to Target 2026-01-15 15:06:29 +01:00
bors
7704328ba5 Auto merge of #151158 - Zalathar:rollup-okXJcXA, r=Zalathar
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150846 (include `HirId`s directly in the THIR, not wrapped in `LintLevel`s)
 - rust-lang/rust#150979 (Avoid ICEs after bad patterns, for the other syntactic variants)
 - rust-lang/rust#151103 (mir_build: Simplify length-determination and indexing for array/slice patterns)
 - rust-lang/rust#151130 (resolve: Downgrade `ambiguous_glob_imports` to warn-by-default)

r? @ghost
2026-01-15 12:33:17 +00:00
Stuart Cook
256722639d
Rollup merge of #151130 - diesel2, r=lqd
resolve: Downgrade `ambiguous_glob_imports` to warn-by-default

But still keep it report-in-deps, as decided in https://github.com/rust-lang/rust/issues/149845#issuecomment-3750423840.

This will need to be reverted after ~February 27 2026, when Rust 1.95 branches out from the main branch.

Closes https://github.com/rust-lang/rust/issues/149845.
2026-01-15 21:39:04 +11:00