Commit graph

318117 commits

Author SHA1 Message Date
Jonathan Brouwer
98e8f99bc0
Rollup merge of #152218 - adwinwhite:fix-mir-borrowck-opaque-handling-keep-all-errors, r=lcnr
Report unconstrained region in hidden types lazily

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/264

I didn't copy the mechanism of HIR typeck as I found that we just need to be lax in the unconstrained region case.
It already ignores non-defining uses and invalid params.

About tests, I'm having trouble coming up with more complex ones. 🙁

This fixes `ukanren` and `codecrafters-redis-rust` but not rust-lang/rust#151322 and rust-lang/rust#151323.
I believe they are a [different problem](https://github.com/rust-lang/rust/issues/151322#issuecomment-3864656974).

r? @lcnr
2026-02-13 13:35:00 +01:00
Jonathan Brouwer
a211e2fbba
Rollup merge of #152555 - JonathanBrouwer:port_diagnostic_item, r=jdonszelmann
Port `#[rustc_diagnostic_item]` to the new attribute parsers

r? @jdonszelmann
2026-02-13 13:34:59 +01:00
Jonathan Brouwer
6fa5694807
Rollup merge of #152515 - Zalathar:dep-kind-vtables, r=nnethercote
Extract `DepKindVTable` constructors to their own module

This is a fairly substantial chunk of code in `rustc_query_impl::plumbing` that mostly doesn't need to be inside a macro at all.

The part that does need to be in a macro is the declaration of a named vtable constructor function for each query. I have extracted that into its own separate call to `rustc_middle::rustc_with_all_queries!` in the new module, so that dep-kind vtable construction is almost entirely confined to `rustc_query_impl::dep_kind_vtables`.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-13 13:34:59 +01:00
Jonathan Brouwer
65d982abd8
Rollup merge of #152469 - mu001999-contrib:cleanup/unused-features, r=nadrieril,jdonszelmann
Remove unused features

Detected by https://github.com/rust-lang/rust/pull/152164.

~~Only allow `unused_features` if there are complex platform-specific features enabled.~~
2026-02-13 13:34:58 +01:00
Jonathan Brouwer
9d662b5815
Rollup merge of #152323 - JohnTitor:issue-135845-2, r=lcnr
Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for rust-lang/rust#135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in https://github.com/rust-lang/rust/pull/147631#issuecomment-3460724226.
Fixes rust-lang/rust#135845
r? @lcnr @jackh726
2026-02-13 13:34:58 +01:00
Zalathar
1d6ef95075 Extract DepKindVTable constructors to their own module 2026-02-13 23:19:20 +11:00
Jonathan Brouwer
cbc661022e Port #[rustc_diagnostic_item] to the new attribute parsers 2026-02-13 09:46:47 +00:00
bors
d7daac06d8 Auto merge of #152562 - Zalathar:rollup-tQDKhYQ, r=Zalathar
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#150551 (Compute localized outlives constraints lazily)
 - rust-lang/rust#150988 (Improve code suggestion for incorrect macro_rules! usage)
 - rust-lang/rust#152422 (Change query proc macro to be more rust-analyzer friendly)
 - rust-lang/rust#152496 (Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto)
 - rust-lang/rust#152514 (Collect active query jobs into struct `QueryJobMap`)
 - rust-lang/rust#152520 (Don't use `DepContext` in `rustc_middle::traits::cache`)
 - rust-lang/rust#152528 (Support serializing CodegenContext)
 - rust-lang/rust#152082 (Move tests)
 - rust-lang/rust#152232 (Add must_use for FileTimes)
 - rust-lang/rust#152329 (Simplify parallel! macro)
 - rust-lang/rust#152444 (`-Znext-solver` Prevent committing unfulfilled unsized coercion)
 - rust-lang/rust#152486 (remove redundant backchain attribute in codegen)
 - rust-lang/rust#152519 (Fix feature gating for new `try bikeshed` expressions)
 - rust-lang/rust#152529 (sparc64: enable abi compatibility test)
 - rust-lang/rust#152548 (reject inline const patterns pre-expansion)
 - rust-lang/rust#152550 (Port #[prelude_import] to the attribute parser)
 - rust-lang/rust#152552 (Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks)

Failed merges:

 - rust-lang/rust#152515 (Extract `DepKindVTable` constructors to their own module)
2026-02-13 08:37:54 +00:00
Yuki Okushi
b0f2ac8797 Return Binder 2026-02-13 14:06:30 +09:00
Stuart Cook
b9ce1e0369
Rollup merge of #152552 - androm3da:hexagon-hvx-abi-rules, r=madsmtm
Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks

Previously, rustc rejected HvxVectorPair types in function signatures because the HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI array only had entries for vectors up to 1024 bits. This caused the ABI checker to emit "unsupported vector type" errors for 2048-bit HvxVectorPair (used in 128-byte HVX mode).

Add 2048 byte entry to allow HvxVectorPair to be passed in extern "C" funcs when the hvx-length128b is enabled.
2026-02-13 15:19:15 +11:00
Stuart Cook
9e0a05b481
Rollup merge of #152550 - Ozzy1423:rustc-attrs, r=JonathanBrouwer
Port #[prelude_import] to the attribute parser

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

r? @JonathanBrouwer

Didn't change any use-sites of it in the compiler
2026-02-13 15:19:15 +11:00
Stuart Cook
5266800936
Rollup merge of #152548 - dianne:reject-const-block-pat-pre-expansion, r=fmease
reject inline const patterns pre-expansion

Reverts the parser changes from https://github.com/rust-lang/rust/pull/149667

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

Awkwardly, some cases of inline const pats can only be caught pre-expansion and some can only be caught post-expansion. https://github.com/rust-lang/rust/pull/149667 switched from only rejecting the former to only rejecting the latter.
2026-02-13 15:19:14 +11:00
Stuart Cook
3b0a16738a
Rollup merge of #152529 - folkertdev:sparc64-enable-abi-compat-test, r=RalfJung
sparc64: enable abi compatibility test

fixes https://github.com/rust-lang/rust/issues/115336

We can now remove the exceptions for sparc64 from the abi compatibility tests (since https://github.com/rust-lang/rust/pull/142680).

I was also able to remove a cfg for mips64. The remaining (tested) issues seem to be around how `f64` is handled there.

cc @RalfJung
r? tgross35
2026-02-13 15:19:14 +11:00
Stuart Cook
426921007e
Rollup merge of #152519 - scottmcm:fix-152501, r=fmease
Fix feature gating for new `try bikeshed` expressions

r? fmease
Fixes rust-lang/rust#152501
2026-02-13 15:19:13 +11:00
Stuart Cook
8b036c7b72
Rollup merge of #152486 - fneddy:s390x_simplify_backchain, r=dingxiangfei2009
remove redundant backchain attribute in codegen

llvm will look at both
1. the values of `"target-features"` and
2. the function string attributes.

this patch removes the redundant function string attribute because it is not needed at all. rustc sets the `+backchain` attribute through `target_features_attr(...)`
d34f1f9314/compiler/rustc_codegen_llvm/src/attributes.rs (L590)
d34f1f9314/compiler/rustc_codegen_llvm/src/attributes.rs (L326-L337)
2026-02-13 15:19:13 +11:00
Stuart Cook
0c0af5c6a8
Rollup merge of #152444 - ShoyuVanilla:unsized-recursion-limit, r=lcnr
`-Znext-solver` Prevent committing unfulfilled unsized coercion

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/266

r? lcnr
2026-02-13 15:19:12 +11:00
Stuart Cook
09720ec3d0
Rollup merge of #152329 - Zoxc:simple-parallel-macro, r=nnethercote
Simplify parallel! macro

This replaces the `parallel!` macro with a `par_fns` function.
2026-02-13 15:19:12 +11:00
Stuart Cook
eaa6766793
Rollup merge of #152232 - chenyukang:add-must-use-for-filetimes, r=Mark-Simulacrum
Add must_use for FileTimes

Fixes rust-lang/rust#152231
2026-02-13 15:19:11 +11:00
Stuart Cook
492eb8361e
Rollup merge of #152082 - Delta17920:move-tests, r=chenyukang,Kivooeo
Move tests

moved few tests

r? @Kivooeo
2026-02-13 15:19:11 +11:00
Stuart Cook
1378e9efeb
Rollup merge of #152528 - bjorn3:lto_refactors11, r=petrochenkov
Support serializing CodegenContext

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-13 15:19:10 +11:00
Stuart Cook
caca3d4f1a
Rollup merge of #152520 - Zalathar:traits-cache, r=dingxiangfei2009
Don't use `DepContext` in `rustc_middle::traits::cache`

- A nice little simplification unlocked by https://github.com/rust-lang/rust/pull/152199.

---

This code is now in `rustc_middle`, and doesn't need any non-trivial methods, so it can just use `TyCtxt` directly instead.
2026-02-13 15:19:10 +11:00
Stuart Cook
504bc6699c
Rollup merge of #152514 - Zalathar:job-map, r=nnethercote
Collect active query jobs into struct `QueryJobMap`

This PR encapsulates the existing `QueryMap` type alias into a proper struct named `QueryJobMap`, which is used by code that wants to inspect the full set of currently-active query jobs.

Wrapping the query job map in a struct makes it easier to see how other code interacts with the map, and also lets us change some free functions for map lookup into methods.

We also do a renaming pass to consistently refer to the query job map as `job_map`, or as `job_map_out` in the places where it's a mutable out-parameter.

There should be no change to compiler behaviour.

r? nnethercote (or compiler)
2026-02-13 15:19:09 +11:00
Stuart Cook
15e349d084
Rollup merge of #152496 - ZuseZ4:fix-autodiff-dbg-build, r=bjorn3
Fix multi-cgu+debug builds using autodiff by delaying autodiff till lto

fixes: https://github.com/rust-lang/rust/issues/152470

r? @bjorn3
2026-02-13 15:19:09 +11:00
Stuart Cook
bc3b9de404
Rollup merge of #152422 - Zoxc:query-macro-tweaks, r=Zalathar
Change query proc macro to be more rust-analyzer friendly

This changes the query proc macro to be more rust-analyzer friendly.

- Types in the macro now have a proper span
- Some functions have their span hidden so they don't show up when hovering over the query name
- Added a hint on the provider field on how to find providers. That is shown when hovering over the query name
- Linked query name to the provider field on all queries, not just ones with caching
- Added tooltip for the query modifiers by linking to the new types in `rustc_middle:::query::modifiers`
2026-02-13 15:19:08 +11:00
Stuart Cook
6c2700b256
Rollup merge of #150988 - chenyukang:yukang-fix-150899-macro-rules, r=petrochenkov
Improve code suggestion for incorrect macro_rules! usage

Fixes rust-lang/rust#150899
2026-02-13 15:19:08 +11:00
Stuart Cook
5df4f59fe3
Rollup merge of #150551 - lqd:lazy-polonius, r=jackh726
Compute localized outlives constraints lazily

This PR rewrites the loan liveness algorithm to compute localized constraints lazily during traversal, to avoid the sometimes costly conversion and indexing happening in the current eager algorithm (or for now as well, the need to reshape the liveness data to better list regions live at a given point).

It thus greatly reduces the current alpha overhead, although it wasn't entirely removed of course (we're obviously doing more work to improve precision): the worst offending benchmark has a +5-6% wall-time regression — but icounts are worse looking (+13%) rn.

Best reviewed per-commit, as steps are in sequence to simplify the process or unify some things.

r? @jackh726
2026-02-13 15:19:07 +11:00
Adwin White
20c46d647f report unconstrained region in hidden types lazily 2026-02-13 11:38:53 +08:00
Yuki Okushi
45bc47e4e2 Apply review suggestions 2026-02-13 12:26:16 +09:00
Yuki Okushi
7d7b381660 Fix ICE in borrowck when recovering fn_sig for -> _ 2026-02-13 12:26:16 +09:00
mu001999
73c42c1800 Remove or allow unused features in library doc and tests 2026-02-13 09:27:16 +08:00
mu001999
a318a207f0 Remove unused features in librustdoc 2026-02-13 09:25:56 +08:00
mu001999
0dc1556968 Remove unused features in library 2026-02-13 09:25:50 +08:00
mu001999
a07f837491 Remove unused features in compiler 2026-02-13 09:25:39 +08:00
Scott McMurray
6afebcc4dd Fix feature gating for new try bikeshed expressions 2026-02-12 12:17:49 -08:00
Brian Cain
eb1e411629 Add 2048-bit HvxVectorPair support to Hexagon SIMD ABI checks
Previously, rustc rejected HvxVectorPair types in function signatures
because the HEXAGON_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI array
only had entries for vectors up to 1024 bits. This caused the ABI checker
to emit "unsupported vector type" errors for 2048-bit HvxVectorPair
(used in 128-byte HVX mode).

Add 2048 byte entry to allow HvxVectorPair to be passed
in extern "C" funcs when the hvx-length128b is enabled.
2026-02-12 13:02:47 -06:00
Rémy Rakic
285e1be7b4 reduce duplication when finding a successor 2026-02-12 18:29:38 +00:00
Rémy Rakic
880d73396f merge remaining contexts
now that we need to hold the graph for MIR dumping, and the associated
data to traverse it, there is no difference between the main context and
diagnostics context, so we merge them.
2026-02-12 18:29:38 +00:00
Rémy Rakic
1b63325435 adapt polonius MIR dump to lazy graph traversal 2026-02-12 18:29:38 +00:00
Rémy Rakic
7de450ad52 introduce graph traversal abstraction and visitor
we may need to traverse the lazy graph multiple times:
- to record loan liveness
- to dump the localized outlives constraint in the polonius MIR dump

to do that we extract the previous loan liveness code into an abstract
traversal + visitor handling the liveness-specific parts, while the MIR
dump will be able to record constraints in its own visitor.
2026-02-12 18:29:38 +00:00
Rémy Rakic
f4abd15bc5 remove unneeded liveness context
now that the analysis is only using the regular liveness shape, we don't
need to store it transposed, and thus don't need the container where it
was stored: the liveness context would be alone in the polonius context.

we thus remove the latter, and rename the former.
2026-02-12 18:29:38 +00:00
Rémy Rakic
5d151083fc optimization: do nothing if there are no loans 2026-02-12 18:29:38 +00:00
Rémy Rakic
6dcf65a1cb optimization: no need to convert liveness data shape anymore 2026-02-12 18:29:38 +00:00
Rémy Rakic
279d55c30a remove eager constraint conversion 2026-02-12 18:29:38 +00:00
Rémy Rakic
0941151f30 introduce lazy traversal for the polonius constraint graph 2026-02-12 18:29:37 +00:00
Oscar Bray
dd8a98a9bc Fix pretty print tests with #[prelude_import] 2026-02-12 17:43:58 +00:00
Oscar Bray
8526aa5361 Port #[prelude_import] to the attribute parser 2026-02-12 17:43:04 +00:00
bors
47611e1604 Auto merge of #152538 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

8 commits in 0c9e687d237ff04b53ccb67b4ce63e9483789e88..ce69df6f72a3b6a2b5c722ba68ddef255344b31c
2026-02-11 05:58:30 +0000 to 2026-02-12 12:39:45 +0000
- fix: apply `host.runner` only when `host-config` enabled (rust-lang/cargo#16631)
- fix(cli): Improve bad manifest error  (rust-lang/cargo#16630)
- fix: Adjust casing of error message (rust-lang/cargo#16625)
- Enable triagebot new `[view-all-comments-link]` feature (rust-lang/cargo#16629)
- test(help): snapshot cargo help tests (rust-lang/cargo#16626)
- Suggest a `workspace.members` entry even from outside the workspace root (rust-lang/cargo#16616)
- Reorganize build unit directory layout for new build-dir layout (rust-lang/cargo#16542)
- Make the error messaging for `cargo install` aware of `build.build-dir` (rust-lang/cargo#16623)
2026-02-12 17:30:25 +00:00
dianne
60f802fe11 reject inline const patterns pre-expansion 2026-02-12 08:26:03 -08:00
Shoyu Vanilla
891acbd787 -Znext-solver Prevent committing unfulfilled unsized coercion 2026-02-13 00:57:01 +09:00
Zalathar
b9b28ba1b5 Collect active query jobs into struct QueryJobMap 2026-02-13 01:18:24 +11:00