Commit graph

53255 commits

Author SHA1 Message Date
bjorn3
ef00ebfdec Remove is_ctfe_mir_available query
It isn't called anywhere anymore.
2026-02-04 15:58:47 +00:00
bors
930ecbcdf8 Auto merge of #152089 - JonathanBrouwer:rollup-h74gaTC, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#151893 (Move the query list into a new `rustc_middle::queries` module)
 - rust-lang/rust#152060 (ci: Optimize loongarch64-linux dist builders)
 - rust-lang/rust#151993 (Add uv to the list of possible python runners)
 - rust-lang/rust#152047 (Convert to inline diagnostics in `rustc_interface`)
 - rust-lang/rust#152053 (Avoid semicolon suggestion when tail expr is error)

Failed merges:

 - rust-lang/rust#152023 (Some `rustc_query_system` cleanups)
2026-02-04 08:37:48 +00:00
Jonathan Brouwer
b8755a44fc
Rollup merge of #152053 - TaKO8Ki:err-tail-semicolon-suggest, r=nnethercote
Avoid semicolon suggestion when tail expr is error

Fixes rust-lang/rust#151610

When the tail expression is Err due to recovery, HIR constructs `StmtKind::Semi(Err(..))`. The suggestion path then uses `stmt.span.with_lo(tail_expr.span.hi())` to target the semicolon, but `stmt.span == tail_expr.span` so the derived span is empty/invalid.
2026-02-04 08:12:42 +01:00
Jonathan Brouwer
3bb8cd4d84
Rollup merge of #152047 - JonathanBrouwer:convert_interface, r=jdonszelmann
Convert to inline diagnostics in `rustc_interface`

For https://github.com/rust-lang/rust/issues/151366#event-22181360642
2026-02-04 08:12:42 +01:00
Jonathan Brouwer
89594620f2
Rollup merge of #151893 - Zoxc:query-mod-move, r=nnethercote
Move the query list into a new `rustc_middle::queries` module

This moves the query list from `rustc_middle::query` into a new `rustc_middle::queries` module. This splits up the use of the query system from the remaining implementation of it in `rustc_middle::query`, which conceptually belong to `rustc_query_system`.

The goal is to let rustc crates define queries with their own `queries` module, and this makes `rustc_middle` also fit this pattern.

The inner `queries` module used by the macros are renamed to `query_info`, so it doesn't conflict with the new outer name.
2026-02-04 08:12:40 +01:00
Jonathan Brouwer
e7c142cc89
Convert to inline diagnostics in rustc_interface 2026-02-04 08:10:10 +01:00
bors
794495e2b4 Auto merge of #151546 - Zoxc:feedable-macro-fix, r=Zalathar
Pass on the `feedable` query modifier to macros

This passes on the `feedable` query modifier to macros so `QueryConfig.feedable` gives the correct result. Currently it's always false even for feedable queries.

Fixing this bug enables some consistency checks for feedable queries that were previously not being performed, which has a perf impact.
2026-02-04 04:36:37 +00:00
bors
1d05e3c131 Auto merge of #152075 - JonathanBrouwer:rollup-TaaDPXF, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#148967 (const-eval: always do mem-to-mem copies if there might be padding involved)
 - rust-lang/rust#152012 (Use `DEVELOPER_DIR` instead of a custom `xcode-select` script)
 - rust-lang/rust#152044 (Convert to inline diagnostics in `rustc_incremental`)
 - rust-lang/rust#152046 (Use glob imports for attribute parsers)
 - rust-lang/rust#152054 (Distinguish error message for `#[diagnostic::on_const]` on const trait impls)
 - rust-lang/rust#152059 (Fix some autodiff tests require Clto=fat)
 - rust-lang/rust#152073 (Convert to inline diagnostics in `rustc_mir_dataflow`)
2026-02-04 01:28:47 +00:00
Jonathan Brouwer
7960088392
Rollup merge of #152073 - JonathanBrouwer:convert_mir_dataflow, r=lqd
Convert to inline diagnostics in `rustc_mir_dataflow`

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-03 23:29:58 +01:00
Jonathan Brouwer
9ff335cb8f
Rollup merge of #152054 - lapla-cogito:diag_const_trait_impl, r=estebank
Distinguish error message for `#[diagnostic::on_const]` on const trait impls

context: https://github.com/rust-lang/rust/pull/149627#discussion_r2589712535

Sorry for the delay between receiving the review and submitting this patch. I'll ask the original proposer to review it.

r? estebank
2026-02-03 23:29:57 +01:00
Jonathan Brouwer
1e15bda9db
Rollup merge of #152046 - clubby789:glob-attrs, r=JonathanBrouwer
Use glob imports for attribute parsers

r? JonathanBrouwer
2026-02-03 23:29:57 +01:00
Jonathan Brouwer
df2daa3628
Rollup merge of #152044 - JonathanBrouwer:rustc_incremental_convert, r=lqd
Convert to inline diagnostics in `rustc_incremental`

For https://github.com/rust-lang/rust/issues/151366
2026-02-03 23:29:56 +01:00
Jonathan Brouwer
bfc624986f
Rollup merge of #148967 - RalfJung:const-eval-preserve-src-padding, r=JonathanBrouwer,traviscross
const-eval: always do mem-to-mem copies if there might be padding involved

This is the final piece of the puzzle for https://github.com/rust-lang/rust/issues/148470: when copying data of a type that has padding, always do a mem-to-mem copy, so that we always preserve the source padding exactly. That prevents rustc implementation choices from leaking into user-visible behavior.

This is technically a breaking change: the example at the top of https://github.com/rust-lang/rust/issues/148470 no longer compiles with this. However, it seems very unlikely that anyone would have depended on this. My main concern is not backwards compatibility, it is performance.

Fixes rust-lang/rust#148470

---

> Actually that seems to be entirely fine, it even helps with some benchmarks! I guess the mem-to-mem codepath is actually faster than the scalar pair codepath for the copy itself. It can slow things down later since now we have to do everything bytewise, but that doesn't show up in our benchmarks and might not be very relevant after all (in particular, it only affects types with padding, so the rather common wide pointers still always use the efficient scalar representation).
>
> So that would be my proposal to for resolving this issue then: to make const-eval behavior consistent, we always copy the padding from the source to the target. IOW, potentially pre-existing provenance in the target always gets overwritten (that part is already in https://github.com/rust-lang/rust/pull/148259), and potentially existing provenance in padding in the source always gets carried over (that's https://github.com/rust-lang/rust/pull/148967). If there's provenance elsewhere in the source our existing handling is fine:
> - If it's in an integer, that's UB during const-eval so we can do whatever.
> - If it's in a pointer, the the fragments must combine back together to a pointer or else we have UB.
> - If it's in a union we just carry it over unchanged.
>
> @traviscross we should check that this special const-eval-only UB is properly reflected in the reference. Currently we have [this](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html#r-undefined.const-transmute-ptr2int) but that only talks about int2ptr, not about invalid pointer fragments at pointer type. I also wonder if this shouldn't rather be part of ["invalid values"](https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html#r-undefined.validity) to make it clear that this applies recursively inside fields as well.
> EDIT: Reference PR is up at https://github.com/rust-lang/reference/pull/2091.

 _Originally posted by @RalfJung in [#148470](https://github.com/rust-lang/rust/issues/148470#issuecomment-3538447283)_

> Worth noting that this does not resolve the concerns @theemathas had about `-Zextra-const-ub-checks` sometimes causing *more* code to compile. Specifically, with that flag, the behavior changes to "potentially existing provenance in padding in the source never gets carried over". However, it's a nightly-only flag (used by Miri) so while the behavior is odd, I don't think this is a problem.

 _Originally posted by @RalfJung in [#148470](https://github.com/rust-lang/rust/issues/148470#issuecomment-3538450164)_

---

Related:

- https://github.com/rust-lang/rust/issues/148470
- https://github.com/rust-lang/reference/pull/2091
2026-02-03 23:29:55 +01:00
Jamie Hill-Daniel
828bead9e3 Use glob imports for attribute parsers 2026-02-03 22:27:56 +00:00
Jonathan Brouwer
4fdd085e28
Convert to inline diagnostics in rustc_mir_dataflow 2026-02-03 23:25:59 +01:00
Jonathan Brouwer
4cacfc00bc
Convert to inline diagnostics in rustc_incremental 2026-02-03 23:22:48 +01:00
bors
0c40f5be0c Auto merge of #151929 - camsteffen:lengg, r=BoxyUwU
Use with_capacity in query_key_hash_verify and PlaceholderExpander

Addresses the first two items from https://github.com/rust-lang/rust/issues/137005#issuecomment-2687803558.
2026-02-03 22:20:57 +00:00
John Kåre Alsaker
9de16dd3eb Remove imports in queries only used by define_callbacks! 2026-02-03 21:33:16 +01:00
John Kåre Alsaker
247a022957 Fix references and remove inner queries module 2026-02-03 21:32:52 +01:00
John Kåre Alsaker
c9f4f7f443 Move the query list to queries.rs 2026-02-03 21:20:56 +01:00
Jonathan Brouwer
7997b11cfd
Rollup merge of #152041 - JonathanBrouwer:query_system_convert, r=jdonszelmann
Convert to inline diagnostics in `rustc_query_system`

For https://github.com/rust-lang/rust/issues/151366#event-22181360642

r? @jdonszelmann (or anyone else who feels like it)
2026-02-03 18:54:51 +01:00
Jonathan Brouwer
e5c125f063
Rollup merge of #152019 - nnethercote:rm-unneeded-HashStable-derives, r=Zalathar
`NativeLib` cleanups

Improvements to `NativeLib`.

r? @Zalathar
2026-02-03 18:54:50 +01:00
Jonathan Brouwer
fabcf5aeb8
Rollup merge of #151944 - JonathanBrouwer:diag4, r=jdonszelmann
Convert to inline diagnostics in `rustc_attr_parsing`

Converts a crate for rust-lang/rust#151366
This PR is almost completely autogenerated by a hacky script I have locally :)
2026-02-03 18:54:49 +01:00
Jonathan Brouwer
cb6eb81c91
Rollup merge of #151874 - khyperia:error-unsized-anonconst, r=BoxyUwU
error on unsized AnonConsts

The constant evaluator does not support unsized types, however, unsized AnonConsts were never checked to be Sized, so no errors were generated on them and the constant was attempted to be constant evaluated. This caused the constant evaluator to ICE.

Add a special case for AnonConsts in rustc_hir_typeck, as suggested by @BoxyUwU in rust-lang/rust#137582. There is no checking for `#![feature(unsized_const_params)]` which should eventually revert this check when the feature becomes more implemented.

That issue is assigned to @el-ev but I started looking into this as a jumping off point / motivation to learn some compiler stuff, and I eventually got to the point of fixing it, so I'm submitting a PR anyway. So just a ping/FYI to @el-ev that I'm submitting this, sorry!

There are three relevant github issues to this ICE that I could find:

- fixes rust-lang/rust#137582
- fixes rust-lang/rust#151591

The similar issue rust-lang/rust#104685 is NOT fixed, it might be good to glance at that before verifying this particular fix, to make sure this fix is actually in the right place. (I haven't looked at it much)

r? @BoxyUwU
2026-02-03 18:54:49 +01:00
Jonathan Brouwer
e0f6b3b665
Rollup merge of #151848 - clubby789:rustc-mir-port, r=JonathanBrouwer
Port `rustc_mir` to attribute parser

Tracking issue: rust-lang/rust#131229
2026-02-03 18:54:48 +01:00
Jonathan Brouwer
d4ea6a9a6b
Rollup merge of #151754 - mu001999-contrib:fix/151708, r=BoxyUwU
Check proj's parent is trait or not when checking dyn compatibility

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

When checking dyn compatibility, `proj` here may point to free const whose parent is not trait. Then `TraitRef::from_assoc` will call `generics_of` on the wrong parent.

After this change, the following case without `#[type_const]` will still emit ICE same to https://github.com/rust-lang/rust/issues/149066, but different to the ICE reported in https://github.com/rust-lang/rust/issues/151708
```rust
#![feature(min_generic_const_args)]

// #[type_const]
const N: usize = 2;

trait CollectArray {
    fn inner_array(&self) -> [i32; N];
}
```

r? @BoxyUwU
2026-02-03 18:54:48 +01:00
Jonathan Brouwer
b3b66b23e6
Rollup merge of #149263 - frank-king:feature/unpin-check, r=BoxyUwU
Forbid manual `Unpin` impls for structurally pinned types

Part of [`pin_ergonomics`](https://github.com/rust-lang/rust/issues/130494). It forbids to `impl Unpin for T` where `T` is an ADT marked with `#[pin_v2]`.
2026-02-03 18:54:47 +01:00
Jonathan Brouwer
13e97ac9b2
Rollup merge of #152045 - JonathanBrouwer:rustc_infer_convert, r=lqd
Convert to inline diagnostics in `rustc_infer`

For https://github.com/rust-lang/rust/issues/151366
2026-02-03 18:54:47 +01:00
Jonathan Brouwer
46090073b9
Rollup merge of #152039 - Zalathar:context-mismatch, r=chenyukang
coverage: Add a test case for a previously-unknown span mismatch

- This is a revised version of https://github.com/rust-lang/rust/pull/152036.
---

In https://github.com/rust-lang/rust/pull/145643, a defensive check was added to detect spans that unexpectedly don't match the context of the function body span. There was no known way to trigger that condition, so a `debug_assert!` was added to make violations easier to notice.

A way to trigger the condition using nested macro expansions was subsequently found and reported as an ICE (in debug-assertion builds) in https://github.com/rust-lang/rust/issues/147339.

Now that we have a concrete example to investigate, we can remove the `debug_assert!` so that there is no ICE in debug-assertion builds.

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

r? chenyukang
2026-02-03 18:54:46 +01:00
Takayuki Maeda
d329971fc2 avoid semicolon suggestion when tail expr is error
add a link to the issue

fix test stderr
2026-02-04 01:15:51 +09:00
lapla
dfc60ae100
Distinguish error message for #[diagnostic::on_const] on const trait impls 2026-02-04 00:38:04 +09:00
Jonathan Brouwer
1722b8e06b
Convert to inline diagnostics in rustc_infer 2026-02-03 15:14:49 +01:00
bors
55407b8cdb Auto merge of #151853 - Zalathar:feed-vtable, r=oli-obk
Use the query vtable in `query_feed` plumbing

The `query_feed` function needs to be able to do two important things with (erased) query values: hash them, and debug-print them.

Both of those are things that the query's vtable already knows how to do. So by passing in a vtable to `query_feed`, we can give it a nicer signature, avoid having to unerase values in the function itself, and clean up some caller-side code as well.
2026-02-03 14:09:42 +00:00
Jamie Hill-Daniel
b668057d79 Port rustc_mir to attribute parser 2026-02-03 13:55:45 +00:00
Jonathan Brouwer
30f82aac5b
Convert to inline diagnostics in rustc_query_system 2026-02-03 14:01:05 +01:00
Jonathan Brouwer
5e30860d31
Don't check variables in subdiagnostic messages 2026-02-03 13:24:04 +01:00
Zalathar
0418f9aa42 coverage: Add a test case for a previously-unknown span mismatch 2026-02-03 22:53:38 +11:00
Stuart Cook
b0552e6077
Rollup merge of #152028 - JonathanBrouwer:diag_driver_impl, r=jdonszelmann
Convert to inline diagnostics in `rustc_driver_impl`

Converts a crate for rust-lang/rust#151366
This PR is almost completely autogenerated by a hacky script I have locally :)
2026-02-03 21:58:42 +11:00
Stuart Cook
04ebb635a4
Rollup merge of #152017 - Zoxc:query-rem-with_no_trimmed_paths, r=lqd
Remove `with_no_trimmed_paths` use in query macro

We already use `with_no_trimmed_paths!` when calling query descriptors so the extra call generated by the macro is not needed.
2026-02-03 21:58:41 +11:00
Stuart Cook
63303aaa65
Rollup merge of #151919 - JayanAXHF:fix_color_always, r=nnethercote
fix: Make `--color always` always print color with `--explain`

Fixes rust-lang/rust#151643.

This changes the behaviour of `handle_explain` in `rustc_driver_impl` to always output color when the `--color always` flag is set.

r? @tgross35
2026-02-03 21:58:41 +11:00
Jonathan Brouwer
f8fe49ea9e
Introduce inline_fluent macro 2026-02-03 10:19:57 +01:00
Zalathar
e58538c552 Rename collect_active_jobs to several distinct names 2026-02-03 20:10:22 +11:00
Jonathan Brouwer
a9f81ea43e
Convert to inline diagnostics in rustc_attr_parsing 2026-02-03 09:59:11 +01:00
Jonathan Brouwer
c07f10c2c1
Convert to inline diagnostics in rustc_driver_impl 2026-02-03 08:51:31 +01:00
Nicholas Nethercote
3a5d7df841 Add a useful comment on rustc_codegen_ssa::NativeLib. 2026-02-03 15:46:05 +11:00
bors
46c86aef65 Auto merge of #152025 - jhpratt:rollup-Kxb6k3Y, r=jhpratt
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151378 (Codegen tests for Arm Cortex-R82)
 - rust-lang/rust#151936 (Move the `fingerprint_style` special case into `DepKindVTable` creation)
 - rust-lang/rust#152018 (Move bigint helper tracking issues)
 - rust-lang/rust#151958 (Add codegen test for SLP vectorization)
 - rust-lang/rust#151974 (Update documentation for `Result::ok()`)
 - rust-lang/rust#151975 (Work around rustfmt giving up on a large expression)
 - rust-lang/rust#151990 (Fix missing unused_variables lint when using a match guard)
 - rust-lang/rust#151995 (stabilize ptr_as_ref_unchecked)
 - rust-lang/rust#151999 (attribute parsing: pass recovery mode to Parser.)
 - rust-lang/rust#152009 (Port rustc_preserve_ub_checks to attr parser)
 - rust-lang/rust#152022 (rustc-dev-guide subtree update)

Failed merges:

 - rust-lang/rust#151968 (Remove `HasDepContext` by merging it into `QueryContext`)
2026-02-03 04:44:02 +00:00
Jacob Pratt
9e21300b02
Rollup merge of #152009 - Ozzy1423:attrs4, r=JonathanBrouwer
Port rustc_preserve_ub_checks to attr parser

Tracking issue: https://github.com/rust-lang/rust/issues/131229

Port rustc_preserve_ub_checks to attr parser

r? @JonathanBrouwer
2026-02-02 23:12:08 -05:00
Jacob Pratt
cbebacda0b
Rollup merge of #151999 - mejrs:ignore_nonmeta_v2, r=JonathanBrouwer
attribute parsing: pass recovery mode to Parser.

Fixes https://github.com/rust-lang/rust/issues/151996
2026-02-02 23:12:08 -05:00
Jacob Pratt
55590344ba
Rollup merge of #151995 - RalfJung:ptr_as_ref_unchecked, r=jhpratt
stabilize ptr_as_ref_unchecked

FCP passed in rust-lang/rust#122034.

Closes rust-lang/rust#122034.
2026-02-02 23:12:07 -05:00
Jacob Pratt
b73b8223d8
Rollup merge of #151990 - eggyal:unused-in-match-with-guard, r=nnethercote
Fix missing unused_variables lint when using a match guard

Within a binding pattern match guard, only real reads of a bound local impact its liveness analysis - not the fake read that is injected.

Fixes rust-lang/rust#151983
r? compiler
2026-02-02 23:12:07 -05:00