Commit graph

52927 commits

Author SHA1 Message Date
The rustc-josh-sync Cronjob Bot
ee0fabd98a Merge ref '004d710faf' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@004d710faf
Filtered ref: rust-lang/rust-analyzer@fa83348961
Upstream diff: b6fdaf2a15...004d710faf

This merge was created using https://github.com/rust-lang/josh-sync.
2026-01-22 04:25:48 +00:00
Urgau
91e3e2a37f Add the remapping path documentation scope for rustdoc usage 2026-01-24 15:33:21 +01:00
Jonathan Brouwer
d86afd2ec0
Rollup merge of #151476 - nnethercote:no-unit-ret-ty-in-derive, r=Kobzol
Avoid `-> ()` in derived functions.

`hash` and `assert_receiver_is_total_eq` have no return type. This commit removes the `-> ()` that is currently printed for them.

r? @Kobzol
2026-01-22 13:35:44 +01:00
Jonathan Brouwer
797601b84c
Rollup merge of #151469 - maurer:dead-on-return, r=nikic
llvm: Tolerate dead_on_return attribute changes

The attribute now has a size parameter and sorts differently. Adjust tests to tolerate this.

https://github.com/llvm/llvm-project/pull/171712

r? durin42

@rustbot label llvm-main
2026-01-22 13:35:43 +01:00
Jonathan Brouwer
704eaef9d4
Rollup merge of #151465 - RalfJung:fn-call-vars, r=mati865
codegen: clarify some variable names around function calls

I looked at rust-lang/rust#145932 to try to understand how it works, and quickly got lost in the variable names -- what refers to the caller, what to the callee? So here's my attempt at making those more clear. Hopefully the new names are correct.^^

Cc @JamieCunliffe
2026-01-22 13:35:42 +01:00
Jonathan Brouwer
5cccc7ca02
Rollup merge of #151441 - Keith-Cancel:mgca3, r=BoxyUwU
Fix ICE: Don't try to evaluate type_consts when eagerly collecting items

This fixes https://github.com/rust-lang/rust/issues/151246

The change is pretty straightforward if the Monomorphization strategy is eager which `-Clink-dead-code=true` sets. This then would lead to the existing code to try and evaluate a `type const` which does not have a body to evaluate leading to an ICE. The change is pretty straight forward just skip over type consts.

This also seems like a sensible choice to me since a MonoItem can only be a Fn, Static, or Asm. A type const is none of the aforementioned.

And even if it was added to the MonoItems list it would then later fail this check:
fe98ddcfcf/compiler/rustc_monomorphize/src/collector.rs (L438-L440)
Since that explicitly checks that the MonoItem's `DefKind` is static and not anything else.

One more change is the addition of a simple test of the example code from https://github.com/rust-lang/rust/issues/151246 that checks that code compiles successfully with `-Clink-dead-code=true`.

The only other change was to make the guard checks a little easier to read by making the logic more linear instead of one big if statement.

r? @BoxyUwU
@rustbot label +F-associated_const_equality +F-min_generic_const_args
2026-01-22 13:35:42 +01:00
Jonathan Brouwer
f03c1a2bd3
Rollup merge of #151423 - Voultapher:move-assert-matches, r=Amanieu
Move assert_matches to planned stable path

Another prep PR for https://github.com/rust-lang/rust/pull/137487
2026-01-22 13:35:41 +01:00
Jonathan Brouwer
96a40e9ac3
Rollup merge of #151296 - Human9000-bit:const-array-mir-dump-fix, r=BoxyUwU
MGCA: Fix incorrect pretty printing of valtree arrays

Fixes rust-lang/rust#151126

- **add failing test**
- **fix: additional check whether const array could be printed as raw bytes**

As I figured out, the problem was in `pretty_print_const_valtree`, where it tried to print unevaluated consts as if they were evaluated, which resulted in ICE.
2026-01-22 13:35:41 +01:00
Jonathan Brouwer
0fc86d8fa0
Rollup merge of #151260 - reddevilmidzy:type_const, r=BoxyUwU
Handle unevaluated ConstKind in in_operand

fix: rust-lang/rust#151248

r? BoxyUwU
~~I can't reproduce rust-lang/rust#151246 in my local(x86_64-pc-windows-msvc) even before this change. 🤔
create a draft and test it in different environments.~~
2026-01-22 13:35:40 +01:00
human9000
ff97a6a7f4 fix: allow to print const array as raw bytes only if possible to do so 2026-01-22 15:06:22 +05:00
Jacob Pratt
d43b667377
Rollup merge of #151457 - enthropy7:fix-assert-macro-only, r=enthropy7
Improve error message for assert!() macro in functions returning bool

Detect `assert!()` macro in error messages and provide clearer diagnostics

When `assert!()` is used in a function returning a value, show a message explaining that `assert!()` doesn't return a value, instead of the generic "if may be missing an else clause" error.

Fixes rust-lang/rust#151446
2026-01-22 00:37:44 -05:00
Jacob Pratt
512cc8d785
Rollup merge of #151442 - clubby789:crate-type-port, r=JonathanBrouwer
Port `#![crate_type]` to the attribute parser

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

~~Note that the actual parsing that is used in the compiler session is unchanged, as it must happen very early on; this just ports the validation logic.~~

Also added `// tidy-alphabetical-start` to `check_attr.rs` to make it a bit less conflict-prone
2026-01-22 00:37:43 -05:00
Jacob Pratt
4a983e0900
Rollup merge of #151439 - Mark-Simulacrum:bootstrap-bump, r=nnethercote
Bump bootstrap compiler to 1.94

https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2026-01-22 00:37:43 -05:00
Jacob Pratt
a4cf93bccc
Rollup merge of #151118 - BD103:reflect-slices, r=oli-obk
Support slices in type reflection

Tracking issue: rust-lang/rust#146922

This PR adds support for inspecting slices `[T]` through type reflection. It does so by adding the new `Slice` struct + variant, which is very similar to `Array` but without the `len` field:

```rust
pub struct Slice {
    pub element_ty: TypeId,
}
```

Here is an example reflecting a slice:

```rust
match const { Type::of::<[u8]>() }.kind {
    TypeKind::Slice(slice) => assert_eq!(slice.element_ty, TypeId::of::<u8>()),
    _ => unreachable!(),
}
```

In addition to this, I also re-arranged the type info unit tests.

r? @oli-obk
2026-01-22 00:37:42 -05:00
Nicholas Nethercote
ced38b51fb Avoid -> () in derived functions.
`hash` and `assert_receiver_is_total_eq` have no return type. This
commit removes the `-> ()` that is currently printed for them.
2026-01-22 14:13:55 +11:00
Jamie Hill-Daniel
e73dfaa62f Move collect_crate_types to rustc_interface, and use new attribute parser 2026-01-22 02:34:28 +00:00
Jamie Hill-Daniel
66b78b700b Port crate_type to attribute parser 2026-01-22 02:34:28 +00:00
Jamie Hill-Daniel
e902d0512c Sort do-nothing attributes in check_attributes 2026-01-22 02:30:55 +00:00
bors
b765963267 Auto merge of #150843 - fmease:dyn-ace, r=BoxyUwU
mGCA: Make trait object types with type-level associated consts dyn compatible

Under feature `min_generic_const_args` (mGCA) (rust-lang/rust#132980), render traits with non-parametrized type-level associated constants (i.e., `#[type_const]` ones) dyn compatible but force the user to specify all type-level associated consts in the trait object type via bindings (either directly, via supertrait bounds and/or behind trait aliases) just like associated types, their sibling.

Fixes rust-lang/rust#130300 (feature request).
Fixes rust-lang/rust#136063 (bug).
Fixes rust-lang/rust#137260 (bug).
Fixes rust-lang/rust#137514 (bug).

While I'm accounting for most illegal `Self` references via const projections & params, I'm intentionally ignoring RUST-123140 (and duplicates) in this PR which is to be tackled some other time.

Additional context: Crate `rustc-demangle` had to be updated to fix v0 demangling. I've patched it in PR https://github.com/rust-lang/rustc-demangle/pull/87 which was was released in version 0.1.27 via PR https://github.com/rust-lang/rustc-demangle/pull/88.
2026-01-22 01:56:41 +00:00
Mark Rousskov
3dc7a1f33b Bump stage0 2026-01-21 20:03:56 -05:00
Matthew Maurer
b639b0a4d8 llvm: Tolerate dead_on_return attribute changes
The attribute now has a size parameter and sorts differently:
* Explicitly omit size parameter during construction on 23+
* Tolerate alternate sorting in tests

https://github.com/llvm/llvm-project/pull/171712
2026-01-21 23:39:03 +00:00
Lukas Bergdoll
58be5d6620 Move assert_matches to planned stable path 2026-01-21 23:17:24 +01:00
BD103
a509588fa9 feat: support slices in reflection type info 2026-01-21 16:03:00 -06:00
enthropy7
95b58ac6ac
Improve error message for assert!() macro in functions returning bool 2026-01-22 00:49:56 +03:00
Jonathan Brouwer
18504a1f7b
Rollup merge of #151343 - Ozzy1423:attrs2, r=JonathanBrouwer
Port some crate level attrs to the attribute parser

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

Ports compiler_builtins, panic_runtime, needs_panic_runtime, profiler_runtime and no_builtins to the attribute parsing infrastructure.

r? @JonathanBrouwer
2026-01-21 22:24:03 +01:00
Jonathan Brouwer
afc18426cb
Rollup merge of #151219 - enthropy7:main, r=BoxyUwU
Fixed ICE when using function pointer as const generic parameter

added bounds check in prohibit_explicit_late_bound_lifetimes to prevent index out of bounds panic when args.args is empty. also regression test here to ensure function pointers in const generics produce proper error messages instead of ICE.

Fixes rust-lang/rust#151186
Fixes rust-lang/rust#137084
2026-01-21 22:24:03 +01:00
Oscar Bray
f6d76385e2 Port #![no_builtins] to the attribute parser. 2026-01-21 21:08:28 +00:00
Oscar Bray
54385b52b4 Port #![profiler_runtime] to the attribute parser. 2026-01-21 21:07:57 +00:00
Oscar Bray
1143cb2bb2 Port two panic attrs to the attr parser.
Ports #![panic_runtime] and #![needs_panic_runtime]
2026-01-21 21:07:19 +00:00
Oscar Bray
8c4e48e9b5 Port #![compiler_builtins] to the attribute parser. 2026-01-21 21:06:39 +00:00
León Orell Valerian Liehr
558a59258e
Support debuginfo for assoc const bindings 2026-01-21 18:52:08 +01:00
Ralf Jung
29ed211215 codegen: clarify some variable names around function calls 2026-01-21 18:01:30 +01:00
Jonathan Brouwer
530eeff929
Rollup merge of #151453 - folkertdev:simd-dyn-const, r=RalfJung
make `simd_insert_dyn` and `simd_extract_dyn` const

For use in `stdarch`. We currently use an equivalent of the fallback body here, but on some targets the intrinsic generate better code.

r? RalfJung
2026-01-21 16:39:43 +01:00
Jonathan Brouwer
f87b84ce3d
Rollup merge of #151445 - Zalathar:arenas-default, r=mati865
Derive `Default` for `QueryArenas`

There's no need to manually implement Default for this struct, because the fields are all `TypeArena<_>` or `()`, which both implement Default already.

This lets us avoid one occurrence of the `query_if_arena!` macro.
2026-01-21 16:39:42 +01:00
reddevilmidzy
a158e2e8d6 Handle unevaluated Const::Ty (#[type_const]) 2026-01-22 00:35:12 +09:00
Folkert de Vries
b4220ecb68
make simd_insert_dyn and simd_extract_dyn const 2026-01-21 14:57:33 +01:00
enthropy7
4131674f49
Fix ICE when using function pointer as const generic parameter 2026-01-21 16:31:22 +03:00
Keith-Cancel
7635702d06 Don't try to evaluate type_consts when eagerly collecting items.
Update compiler/rustc_monomorphize/src/collector.rs

Add FIXME(mgca) comment to potentially re-investigate in the future.

Co-Authored-By: Boxy <rust@boxyuwu.dev>
2026-01-21 04:38:53 -08:00
bjorn3
3ccabc6a8d Remove old error emitter
This completes the transition to annotate-snippets
2026-01-21 12:14:51 +00:00
León Orell Valerian Liehr
7f5819317b
mGCA: Render traits dyn incompatible if the ty of an assoc const refs Self (barring Self projections) 2026-01-21 12:53:48 +01:00
León Orell Valerian Liehr
618c15eb6c
Reject const projections behind trait aliases that mention Self
This fully rewords the diagnostic that was previously only emitted for assoc ty bindings.
That's because it incorrectly called trait aliases *type aliases* and didn't really
make it clear what the root cause is.

The added test used to ICE prior to this change.

I've double-checked that the preexisting test I've modified still ICEs in
nightly-2025-03-29.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
eb0e3ac687
mGCA: Force users to specify type assoc consts from supertraits that would otherwise ref Self
The added test used to ICE prior to this change.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
233a45c41a
Fix handling of const params defaults that ref Self & generalize diag
We used to lower such bad defaulted const args in trait object types to
`{type error}`; now correctly lower them to `{const error}`.

The added tests used to ICE prior to this change.
2026-01-21 12:53:47 +01:00
León Orell Valerian Liehr
baba337869
Introduce AssocTag::descr & refactor in the vicinity 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
7c8210ea1f
Generalize diag for conflicting assoc type bindings to account for assoc consts 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
9b861ace46
Generalize diag for missing assoc types to account for assoc consts 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
7777958231
mGCA: Permit certain const projections in dyn-compatible traits 2026-01-21 12:53:46 +01:00
León Orell Valerian Liehr
4a6b5edba8
Fix v0 symbol mangling for assoc const bindings 2026-01-21 12:53:45 +01:00
León Orell Valerian Liehr
8d524f096d
mGCA: Make traits with type assoc consts dyn compatible...
...but require all assoc consts to be specified via bindings.
2026-01-21 12:53:44 +01:00
Zalathar
2495e5834b Add some comments to QueryArenas 2026-01-21 18:10:53 +11:00