Commit graph

53630 commits

Author SHA1 Message Date
Martin Nordholts
52b19f7dda compiler: Don't mark SingleUseConsts MIR pass as "required for soundness"
Because:
* Something like it did not exist before PR 107404
* That it is not run our mir-opt-level 0 indicates that it is not
  required for soundness
* Its `MirPass::can_be_overridden()` is unchanged and thus returns true,
  indicating that it is not a required MIR pass.
* No test fails in PR 151426 that stops enabling by default in non-optimized builds

As can be seen from the updated test `tests/mir-opt/optimize_none.rs`,
this means that `#[optimize(none)]` functions become even less
optimized. As expected and as desired.
2026-02-17 06:22:39 +01:00
bors
bb8b30a5fc Auto merge of #148537 - oli-obk:push-yxuttqrqqyvu, r=dianqk
Start using pattern types in libcore (NonZero and friends)

part of rust-lang/rust#136006 

This PR only changes the internal representation of `NonZero`, `NonMax`, ... and other integral range types in libcore. This subsequently affects other types made up of it, but nothing really changes except that the field of `NonZero` is now accessible safely in contrast to the `rustc_layout_scalar_range_start` attribute, which has all kinds of obscure rules on how to properly access its field.
2026-02-12 13:23:22 +00:00
bors
7ad4e69ad5 Auto merge of #152517 - jhpratt:rollup-fGRcId6, r=jhpratt
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#142415 (Add note when inherent impl for a alias type defined outside of the crate)
 - rust-lang/rust#142680 (Fix passing/returning structs with the 64-bit SPARC ABI)
 - rust-lang/rust#150768 (Don't compute FnAbi for LLVM intrinsics in backends)
 - rust-lang/rust#151152 (Add FCW for derive helper attributes that will conflict with built-in attributes)
 - rust-lang/rust#151814 (layout: handle rigid aliases without params)
 - rust-lang/rust#151863 (Borrowck: simplify diagnostics for placeholders)
 - rust-lang/rust#152159 (Add note for `?Sized` params in int-ptr casts diag)
 - rust-lang/rust#152434 (Clarify names of `QueryVTable` functions for "executing" a query)
 - rust-lang/rust#152478 (Remove tm_factory field from CodegenContext)
 - rust-lang/rust#152498 (Partially revert "resolve: Update `NameBindingData::vis` in place")
 - rust-lang/rust#152316 (fix: add continue)
 - rust-lang/rust#152394 (Correctly check if a macro call is actually a macro call in rustdoc highlighter)
 - rust-lang/rust#152425 (Port #![test_runner] to the attribute parser)
 - rust-lang/rust#152481 (Use cg_ssa's produce_final_output_artifacts in cg_clif)
 - rust-lang/rust#152485 (fix issue#152482)
 - rust-lang/rust#152495 (Clean up some subdiagnostics)
 - rust-lang/rust#152502 (Implement `BinaryHeap::from_raw_vec`)
2026-02-12 06:57:59 +00:00
Jacob Pratt
9376482de2
Rollup merge of #152495 - JonathanBrouwer:remove-empty-subdiags, r=lqd
Clean up some subdiagnostics

Just a nice minor cleanup :)
* Removes some empty subdiagnostics which could just be subdiagnostic attributes
* Convert some manual implementation of `Subdiagnostic` to derives
2026-02-12 00:41:12 -05:00
Jacob Pratt
596faf0f26
Rollup merge of #152481 - bjorn3:backends_reduce_duplication, r=fmease
Use cg_ssa's produce_final_output_artifacts in cg_clif
2026-02-12 00:41:11 -05:00
Jacob Pratt
9cbcd11ae4
Rollup merge of #152425 - Ozzy1423:test-runner, r=JonathanBrouwer
Port #![test_runner] to the attribute parser

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

r? @JonathanBrouwer
2026-02-12 00:41:10 -05:00
Jacob Pratt
3ba1a835d1
Rollup merge of #152316 - cuiweixie:bugfix-continue, r=petrochenkov
fix: add continue

 should be same in:
d3ec6a351a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs (L156-L159)
2026-02-12 00:41:09 -05:00
Jacob Pratt
8193067abd
Rollup merge of #152498 - petrochenkov:revoverglob, r=jieyouxu
Partially revert "resolve: Update `NameBindingData::vis` in place"

Partial revert of 227e7bd48b.
This is a minimal fix for backporting to beta, I'll submit proper fixes later.

Fixes rust-lang/rust#152004
Fixes rust-lang/rust#151124
Fixes rust-lang/rust#152347
2026-02-12 00:41:09 -05:00
Jacob Pratt
c41f9343e9
Rollup merge of #152478 - bjorn3:lto_refactors10, r=wesleywiser
Remove tm_factory field from CodegenContext

This is necessary to support serializing the `CodegenContext` to a `.rlink` file in the future for moving LTO to the `-Zlink-only` step.

Follow up to https://github.com/rust-lang/rust/pull/149209
Part of https://github.com/rust-lang/compiler-team/issues/908
2026-02-12 00:41:08 -05:00
Jacob Pratt
0e746d0a25
Rollup merge of #152434 - Zalathar:call-query, r=nnethercote
Clarify names of `QueryVTable` functions for "executing" a query

In the query system, there are several layers of functions involved in “executing” a query, with very different responsibilities at each layer, making it important to be able to tell them apart.

This PR renames two of the function pointers in `QueryVTable`, along with their associated helper functions, to hopefully do a better job of indicating what their actual responsibilities are.

r? nnethercote
2026-02-12 00:41:08 -05:00
Jacob Pratt
3ad8e9ce04
Rollup merge of #152159 - JohnTitor:issue-74756, r=estebank
Add note for `?Sized` params in int-ptr casts diag

Close rust-lang/rust#74756
2026-02-12 00:41:07 -05:00
Jacob Pratt
e4375da4e8
Rollup merge of #151863 - amandasystems:streamline-borrow-error-handling, r=lcnr
Borrowck: simplify diagnostics for placeholders

This folds the call to `region_from_element` into `RegionInferenceContext`, and simplifies the error variant for this case to only talk about regions as opposed to elements. This is the only case where a `RegionElement` leaks out of region inference, so now they can be considered internal to region inference (though that currently isn't expressed). It also clarifies the type information on the methods called to emphasise the fact that they only ever use placeholder regions in the diagnostics completely ignore any other element.

It also adds a bunch of FIXMEs to some fishy statements that conjure universes from what seems like arbitrary integers.

This was lifted from rust-lang/rust#142623.

r? @lcnr
2026-02-12 00:41:07 -05:00
Jacob Pratt
3db13e22b7
Rollup merge of #151814 - lcnr:silent-layout-error, r=jackh726
layout: handle rigid aliases without params

fixes rust-lang/rust#151791

r? types
2026-02-12 00:41:07 -05:00
Jacob Pratt
2dba56033e
Rollup merge of #151152 - nik-contrib:helper_attr_builtin, r=chenyukang
Add FCW for derive helper attributes that will conflict with built-in attributes

Adds a future-compatibility-warning deny-by-default lint that helps catch invalid derive helper attribute names early.

This issues the lint, saying that `ignore` helper will clash with the built-in `ignore` attribute.

```rust
#![crate_type = "proc-macro"]
#![deny(ambiguous_derive_helpers)]
use proc_macro::TokenStream;

#[proc_macro_derive(Trait, attributes(ignore))]
pub fn example(input: TokenStream) -> TokenStream {
    TokenStream::new()
}
```

If you actually tried to use that `ignore` helper attribute, you won't be able to due to the ambiguity:

```rust
#[derive(Trait)]
struct Foo {
    #[ignore]
    field: (),
}
```

Produces:

```
error[E0659]: `ignore` is ambiguous
 --> src/lib.rs:5:7
  |
5 |     #[ignore]
  |       ^^^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `ignore` could refer to a built-in attribute
note: `ignore` could also refer to the derive helper attribute defined here
 --> src/lib.rs:3:10
  |
3 | #[derive(Trait)]
  |          ^^^^^
```
2026-02-12 00:41:06 -05:00
Jacob Pratt
0041f221ea
Rollup merge of #150768 - bjorn3:llvm_intrinsic_no_fn_abi, r=wesleywiser
Don't compute FnAbi for LLVM intrinsics in backends

~~This removes support for `extern "unadjusted"` for anything other than LLVM intrinsics. It only makes sense in the context of calling LLVM intrinsics anyway as it exposes the way the LLVM backend internally represents types. Perhaps it should be renamed to `extern "llvm-intrinsic"`?~~

Follow up to https://github.com/rust-lang/rust/pull/148533
2026-02-12 00:41:06 -05:00
Jacob Pratt
b1b6533077
Rollup merge of #142680 - beetrees:sparc64-float-struct-abi, r=tgross35
Fix passing/returning structs with the 64-bit SPARC ABI

Fixes the 64-bit SPARC part of rust-lang/rust#115609 by replacing the current implementation with a new implementation modelled on the RISC-V calling convention code ([SPARC ABI reference](https://sparc.org/wp-content/uploads/2014/01/SCD.2.4.1.pdf.gz)).

Pinging `sparcv9-sun-solaris` target maintainers: @psumbera @kulikjak
Fixes rust-lang/rust#115336
Fixes rust-lang/rust#115399
Fixes rust-lang/rust#122620
Fixes https://github.com/rust-lang/rust/issues/147883
r? @workingjubilee
2026-02-12 00:41:05 -05:00
Jacob Pratt
c509454f89
Rollup merge of #142415 - xizheyin:141679, r=estebank
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang/rust#141679

r? compiler
2026-02-12 00:41:05 -05:00
bors
605f49b274 Auto merge of #152506 - Urgau:rollup-MlGAszj, r=Urgau
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#152505 (Sync relnotes for stable 1.93.1)
 - rust-lang/rust#137487 (Stabilize `assert_matches`)
 - rust-lang/rust#152281 (borrowck: suggest `&mut *x` for pattern reborrows)
 - rust-lang/rust#151142 (Support ADT types in type info reflection)
 - rust-lang/rust#152477 (rustc-dev-guide subtree update)
 - rust-lang/rust#152488 (allow `deprecated(since = "CURRENT_RUSTC_VERSION")`)
 - rust-lang/rust#152491 (Remove unused `fluent-syntax` dependency from tidy)
2026-02-12 03:44:50 +00:00
Urgau
f8203c657d
Rollup merge of #152488 - cyrgani:deprecation-staged-api, r=JonathanBrouwer
allow `deprecated(since = "CURRENT_RUSTC_VERSION")`

Motivated by https://github.com/rust-lang/rust/pull/149978.
2026-02-12 00:04:16 +01:00
Urgau
c87a89ed14
Rollup merge of #151142 - SpriteOvO:type-info-adt, r=oli-obk
Support ADT types in type info reflection

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

This PR supports ADT types for feature `type_info` reflection.
(It's still a draft PR, with implementation in progress)

Note that this PR does not take SemVer into consideration (I left a FIXME comment). As discussed earlier ([comment](https://github.com/rust-lang/rust/pull/146923#discussion_r2372249477)), this requires further discussion. However, I hope we could get an initial implementation to land first, so we can start playing with it.

### Progress / Checklist

- [x] Struct support.
- [x] Enum
- [x] Union
- [x] Generics
- [ ] ~Methods~ Implemented and to be implemented in other PRs
- [ ] ~Traits~ Implemented and to be implemented in other PRs
- [x] Rebasing PR to `main` branch
  ~~(It's currently based on PR rust-lang/rust#151123, so here's an extra commit)~~
- [x] Cleanup and Rebase.
- [x] Fix field info for references. (see [comment](https://github.com/rust-lang/rust/pull/151142#discussion_r2777920512))

r? @oli-obk
2026-02-12 00:04:15 +01:00
Urgau
050b48a693
Rollup merge of #152281 - JohnTitor:sugg-mut-deref-borrows, r=estebank
borrowck: suggest `&mut *x` for pattern reborrows

Fixes rust-lang/rust#81059
r? @estebank as you should have some context here, but feel free to re-assign if you don't have time to review right now.
2026-02-12 00:04:14 +01:00
cyrgani
52919c7f81 allow deprecated(since = "CURRENT_RUSTC_VERSION") 2026-02-11 21:39:22 +00:00
Vadim Petrochenkov
324267ccaa Partially revert "resolve: Update NameBindingData::vis in place" 2026-02-11 22:27:56 +03:00
Jonathan Brouwer
ab4891ce74
Convert some impl Subdiagnostics to derives 2026-02-11 19:45:04 +01:00
Jonathan Brouwer
635dcd819a
Remove some empty subdiagnostics 2026-02-11 19:23:46 +01:00
Lukas Bergdoll
2f3b952349 Stabilize assert_matches 2026-02-11 14:13:44 +01:00
Matthias Krüger
336debab2e
Rollup merge of #152383 - RalfJung:BikeshedGuaranteedNoDrop, r=TaKO8Ki
BikeshedGuaranteedNoDrop trait: add comments indicating that it can be observed on stable

Not sure if that's worth it, maybe this goes without saying for all these builtin traits?
2026-02-11 13:48:50 +01:00
Matthias Krüger
dbb1c20f47
Rollup merge of #152372 - nyurik:clippy-rustc_trait_selection, r=mati865
style: remove unneeded trailing commas

Make format-like macro calls look similar to what `cargo fmt` does automatically - remove trailing commas. When removing a comma, I also inlined some variables for consistency and clarity.

I'm working on a [clippy lint](https://github.com/rust-lang/rust-clippy/pull/16530) to make this process automatic.
2026-02-11 13:48:49 +01:00
Matthias Krüger
9a4ce0b5f7
Rollup merge of #152146 - zedddie:mgca-improve-const-bindings-wfck, r=BoxyUwU
mGCA: Add associated const type check

rust-lang/rust#151642

r? BoxyUwU

I didn't bless tests just yet as it only fixes the dyn arm
2026-02-11 13:48:49 +01:00
Matthias Krüger
92e3972ca7
Rollup merge of #152021 - madsmtm:tvos-visionos-watchos-tier-2, r=shepmaster
Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2

Promote the following targets to Tier 2 without host tools:
- `aarch64-apple-tvos`.
- `aarch64-apple-tvos-sim`.
- `aarch64-apple-watchos`.
- `aarch64-apple-watchos-sim`.
- `aarch64-apple-visionos`.
- `aarch64-apple-visionos-sim`.

This implements MCP https://github.com/rust-lang/compiler-team/issues/918. Fixes https://github.com/rust-lang/rust/issues/151705.

r? shepmaster
2026-02-11 13:48:48 +01:00
Matthias Krüger
88eda646f2
Rollup merge of #152431 - oli-obk:limited_stability_attr, r=jdonszelmann
Restrict the set of things that const stability can be applied to

r? @jdonszelmann
2026-02-11 13:48:47 +01:00
Matthias Krüger
2194af9680
Rollup merge of #152419 - nnethercote:mv-more-query-system-code, r=Zalathar
Move more query system code

Towards the goal of eliminating `rustc_query_system`, this commit moves some code from `rustc_query_system` to `rustc_middle` and `rustc_query_impl`, and from `rustc_middle` to `rustc_query_impl`.

r? @Zalathar
2026-02-11 13:48:46 +01:00
bjorn3
1106018af0 Use cg_ssa's produce_final_output_artifacts in cg_clif 2026-02-11 12:36:19 +00:00
bjorn3
f49223c443 Remove tm_factory field from CodegenContext
This is necessary to support serializing the CodegenContext to a .rlink
file in the future for moving LTO to the -Zlink-only step.
2026-02-11 12:18:04 +00:00
Oscar Bray
d1f11fd734 Port #![test_runner] to the attribute parser 2026-02-11 11:33:49 +00:00
bjorn3
2d07e81a5c Move target machine factory error reporting into codegen backend 2026-02-11 10:53:38 +00:00
bjorn3
70587ce07c Remove a couple of unused errors 2026-02-11 10:39:48 +00:00
Zalathar
0de45db240 Clarify names of QueryVTable functions for "executing" a query
This also changes the signature of `call_query_method` to not return a value,
because its only caller immediately discards the value anyway.
2026-02-11 16:50:10 +11:00
bors
7b25457166 Auto merge of #151943 - Zalathar:cache-on-disk, r=TaKO8Ki
Clean up query macros for `cache_on_disk_if`

This PR aims to make the macros for dealing with `cache_on_disk_if` a bit easier to read and work with.

There should be no change to compiler behaviour.
2026-02-10 20:57:44 +00:00
Nik Revenco
846e4ee5dc Add FCW for derive helper attributes that will conflict with built-in attributes 2026-02-10 19:39:19 +00:00
Amanda Stjerna
f53eed56d2
Borrowck: simplify diagnostics for placeholders.
This essentially folds the call to `region_from_element` into `RegionInferenceContext`,
and simplifies the error variant for this case. It also clarifies the type
information on the methods called to emphasise the fact that they only ever use
placeholder regions in the diagnostics, and completely ignore any other element.
2026-02-10 19:39:57 +01:00
lcnr
39a532445a prevent incorrect layout error
aliases may be rigid even if they don't reference params. If the alias isn't well-formed, trying to normalize it as part of the input should have already failed
2026-02-10 18:00:42 +00:00
Mads Marquart
4a01f22a3e Bump tvOS, visionOS and watchOS Aarch64 targets to tier 2 2026-02-10 17:42:12 +01:00
bors
9e79395f92 Auto merge of #151509 - Zoxc:gen-color-race, r=zetanumbers,petrochenkov
Handle race when coloring nodes concurrently as both green and red

This fixes a race where a duplicate dep node gets written to the dep graph if a node was marked as green and promoted during execution, then marked as red after execution.

This can occur when a `no_hash` query A depends on a query B which cannot be forced so it was not colored when starting execution of query A. During the execution of query A it will execute query B and color it green. Before A finishes another thread tries to mark A green, this time succeeding as B is now green, and A gets promoted and written to metadata. Execution of A then finishes and because it's `no_hash` we assume the result changed and thus we color the node again, now as red and write it to metadata again. This doesn't happen with non-`no_hash` queries as they will be green if all their dependencies are green.

This changes the code coloring nodes red to also use `compare_exchange` to deal with this race ensuring that the coloring of nodes only happens once.

Fixes rust-lang/rust#150018
Fixes rust-lang/rust#142778
Fixes rust-lang/rust#141540
2026-02-10 16:17:00 +00:00
Asuna
6ab6734d4b Move ADT related code to a sub module for type info 2026-02-10 14:08:35 +01:00
Asuna
a575fe168f Erase type lifetime before writing type ID 2026-02-10 14:08:11 +01:00
Asuna
b410cb01fe Simplify the writing of tuple type info 2026-02-10 13:53:27 +01:00
Asuna
98e0c34f7f Support unions in type info reflection 2026-02-10 13:53:27 +01:00
Asuna
e9037882c1 Support enums in type info reflection 2026-02-10 13:53:26 +01:00
Asuna
870fd9070b Add generics info for structs in type info 2026-02-10 13:45:09 +01:00