Commit graph

22729 commits

Author SHA1 Message Date
Guillaume Gomez
a928f3352d Rename tests/rustdoc into tests/rustdoc-html 2026-01-07 14:23:30 +01:00
bors
0aced202c2 Auto merge of #150729 - matthiaskrgr:rollup-an2m4zg, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#150026 (Fix macro_metavar_expr_concat behavior with nested repetitions)
 - rust-lang/rust#150521 (resolve: Rename "name bindings" to "name declarations")
 - rust-lang/rust#150704 (MGCA: Const constructors support)
 - rust-lang/rust#150728 (Cleanup some ui tests for const-traits)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-06 19:41:29 +00:00
Matthias Krüger
799c06fa9a
Rollup merge of #150728 - fee1-dead-contrib:const-traits-test-cleanup, r=fmease
Cleanup some ui tests for const-traits

r? project-const-traits

These tests pretty much behave as expected now.
2026-01-06 18:43:30 +01:00
Matthias Krüger
9c45483fe6
Rollup merge of #150704 - Kivooeo:const-ctor, r=BoxyUwU
MGCA: Const constructors support

part of https://github.com/rust-lang/rust/issues/132980

fixes rust-lang/rust#132985
fixes rust-lang/rust#136138
fixes rust-lang/rust#139596

r? BoxyUwU
2026-01-06 18:43:29 +01:00
Matthias Krüger
8add20b77f
Rollup merge of #150026 - Delta17920:fix/150002-macro-concat-bug, r=jdonszelmann
Fix macro_metavar_expr_concat behavior with nested repetitions

**The Bug**: The `${concat(...)}` expression was using the wrong loop index when inside nested repetitions (like optional groups), causing it to get "stuck" on the first element and generate duplicate code.

**The Fix**: Updated `metavar_expr_concat` in `transcribe.rs` to correctly search the repetition stack (`tscx.repeats`) for the target variable instead of blindly using the last index.

**Tests**:
    Added `tests/ui/macros/concat-nested-repetition.rs.`

Fixes rust-lang/rust#150002
2026-01-06 18:43:28 +01:00
Deadbeef
d101412517 Cleanup some ui tests for const-traits 2026-01-06 17:23:16 +00:00
Jonathan Brouwer
58b1130a18
Rollup merge of #150707 - Delta17920:fix-transmute-valtree-ice, r=BoxyUwU
Fix ICE when transmute Assume field is invalid

This PR fixes an internal compiler error in `rustc_transmute` where initializing an `Assume` field (like `alignment`) with a non-scalar constant (like a struct) caused a panic.

The fix updates `from_const` to use `try_to_scalar()` instead of assuming the value is always a leaf. It now gracefully returns `None` for invalid types, allowing the compiler to report standard "missing field initialiser" errors instead of crashing.

Fixes rust-lang/rust#150506
2026-01-06 16:19:44 +01:00
Jonathan Brouwer
dd08360136
Rollup merge of #150695 - Kivooeo:pretty-printing, r=BoxyUwU
MGCA: pretty printing for struct expressions and tuple calls

not sure

1. if there any tests that i need to adjust
2. if i should add any test for it
3. if humanity has come up with anything better than checking if that's first iteration or not with flag when printing sequences with separator

in case there is no tests for it and i dont have to add any, there is a demonstration of this  pretty  printing (this is output from `-Z unpretty=hir`)

```
fn test_errors<const N:
    usize>() {
    // accepts_enum::<{ None::<u32> }>();
    accepts_point::<Point1 { a: N, b: N }>();
    accepts_point::<Point(N, N)>();
}
```

btw it does not print const block

for this

```
accepts_point::<{ Point1 { a: const {N + 1}, b: N } }>();
```

it will print

```
accepts_point::<Point1 { a: { N + 1 }, b: N }>();
```

not sure if we want to print const blocks or not

r? BoxyUwU
2026-01-06 16:19:42 +01:00
Jonathan Brouwer
8b1bf8af85
Rollup merge of #144113 - mu001999-contrib:dead-code/allow-trait, r=jdonszelmann
Impls and impl items inherit `dead_code` lint level of the corresponding traits and trait items

https://github.com/rust-lang/rust/blob/master/compiler/rustc_passes/src/dead.rs#L360-L361 won't insert assoc items into the live set, so that impl items cannot be marked live.

This PR lets impls and impl items can inherit lint levels of the corresponding traits and trait items.

Fixes rust-lang/rust#144060

r? ````@petrochenkov````
2026-01-06 16:19:39 +01:00
Kivooeo
d32f1c695f add const ctor support 2026-01-06 15:04:25 +00:00
bors
74fd7516da Auto merge of #147893 - fee1-dead-contrib:constheapheapheap, r=oli-obk
`Vec::push` in consts MVP

Example:

```rust
const X: &'static [u32] = {
    let mut v = Vec::with_capacity(6);
    let mut x = 1;
    while x < 42 {
        v.push(x);
        x *= 2;
    }
    assert!(v.len() == 6);
    v.const_make_global()
};

assert_eq!([1, 2, 4, 8, 16, 32], X);
```

Oh this is fun...

* We split out the implementation of `Global` such that it calls `intrinsics::const_allocate` and `intrinsics::const_deallocate` during compile time. This is achieved using `const_eval_select`
* This allows us to `impl const Allocator for Global`
* We then constify everything necessary for `Vec::with_capacity` and `Vec::push`.
* Added `Vec::const_make_global` to leak and intern the final value via `intrinsics::const_make_global`. If we see any pointer in the final value of a `const` that did not call `const_make_global`, we error as implemented in rust-lang/rust#143595.

r? `@rust-lang/wg-const-eval`

To-do for me:
* [x] Assess the rustdoc impact of additional bounds in the method
* [x] ~~Increase test coverage~~ I think this is enough for an unstable feature.
2026-01-06 11:39:17 +00:00
delta17920
e603055d89 Fix ICE when transmute Assume field is invalid 2026-01-06 04:38:51 +00:00
bors
da476f1942 Auto merge of #150640 - AprilNEA:mgca-merge-associated-const-equality, r=BoxyUwU
Merge `associated_const_equality` feature gate into MGCA

Tracking Issues: rust-lang/rust#132980 rust-lang/rust#92827

Merge `associated_const_equality`(ACE) feature gate into `min_generic_const_args`(MGCA).

- Replaces `features().associated_const_equality()` checks with `features().min_generic_const_args()`
- Updates the parser to gate associated const equality under `min_generic_const_args`
- Moves `associated_const_equality` to the removed features list
- Removes the `associated_const_equality` method from the `Features` trait
- Updates all affected tests and tools (rust-analyzer, clippy)

Closes rust-lang/rust#150617

r? `@BoxyUwU`
2026-01-06 01:36:53 +00:00
Kivooeo
85c8e41f62 add pretty printing 2026-01-05 21:58:01 +00:00
Jakub Beránek
5bcdc7c131
Rollup merge of #150384 - reddevilmidzy:t14, r=Kivooeo
Tidying up tests/ui/issues 16 tests [7/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

r? Kivooeo
2026-01-05 15:54:13 +01:00
reddevilmidzy
93f8ad9950 cleaned up some tests
cleaned up cast-enum-const.rs

cleaned up ufcs-trait-object-format.rs

add comment to cast-to-box-arr.rs

add comment to shadow-primitives.rs

add comment to associated-type-const-nomalization.rs

add comment to fn-trait-explicit-call.rs

add comment to call-unit-struct-impl-fn-once.rs

add comment to cast-to-char-compare.rs

add comment to self-in-method-body-resolves.rs

add comment to derive-debug-newtype-unsized-slice.rs

add comment to tuple-ref-order-distinct-impls.rs

add comment to derive-debug-generic-with-lifetime.rs

add comment to recursive-trait-bound-on-type-param.rs

cleaned up const-static-ref-to-closure.rs

add comment to const-iter-no-conflict-for-loop.rs
2026-01-05 15:35:01 +09:00
AprilNEA
4421270516
Merge associated_const_equality feature gate into MGCA
This removes `associated_const_equality` as a separate feature gate and makes it part of `min_generic_const_args` (mgca).

Key changes:
  - Remove `associated_const_equality` from unstable features, add to removed
  - Update all test files to use `min_generic_const_args` instead
  - Preserve the original "associated const equality is incomplete" error message by specially handling `sym::associated_const_equality` spans in `feature_gate.rs`
  - Rename FIXME(associated_const_equality) to FIXME(mgca)
2026-01-05 12:31:42 +08:00
bors
6885bdf1af Auto merge of #150603 - Kivooeo:tuple-struct, r=BoxyUwU
MGCA: Support for tuple constructors

r? BoxyUwU

part of https://github.com/rust-lang/rust/issues/132980

fixes rust-lang/rust#136379
fixes rust-lang/rust#138132

i tried to keep implementation very minimal and it's very similar to how structs was implemented with small adjustments

this does not make const constructor like None works, just something like Some(n)

todo:
* ~~tests~~
* write a better description (not sure if needed)
* add more comments and FIXMEs from structs code
2026-01-05 01:45:18 +00:00
reddevilmidzy
5c5c1ff6db moved some test
delete tests/ui/issues/issue-22426.rs duplicated of tests/ui/match/guards.rs
2026-01-05 10:04:46 +09:00
bors
451b7b6c77 Auto merge of #150682 - matthiaskrgr:rollup-jrkhivl, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#149681 (resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings )
 - rust-lang/rust#150426 (Update offload test and verify that tgt_(un)register_lib have the right type)
 - rust-lang/rust#150678 (relate.rs: tiny cleanup: eliminate temp vars)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-04 21:47:15 +00:00
Matthias Krüger
1494755275
Rollup merge of #150426 - ZuseZ4:offload-register-lib, r=davidtwco
Update offload test and verify that tgt_(un)register_lib have the right type

Apparently, we weren't running offload tests when Enzyme wasn't built. Time to fix that.
Also adds a test mode which generates the host IR, but does not expect device IR/artifacts. This way, we don't have to handle artifacts and paths in our tests.
Also removes some outdated documentation.

cc `@Kevinsala,` `@Sa4dUs`

closes: https://github.com/rust-lang/rust/issues/150415

~~blocked on `needs-offload` infrastructure landing in https://github.com/rust-lang/rust/pull/150427~~
2026-01-04 21:14:05 +01:00
Matthias Krüger
df246c107a
Rollup merge of #149681 - petrochenkov:openapi1, r=davidtwco
resolve: Split `Scope::Module` into two scopes for non-glob and glob bindings

This is a re-implementation of https://github.com/rust-lang/rust/pull/144131 with all the issues mentioned there fixed.

As it turned out, the non-trivial part of the split was already done in https://github.com/rust-lang/rust/pull/149454/commits/c91b6ca58d4d870d3099db1defbd8c1f26a7d851, so the remaining part implemented in this PR is *mostly* mechanical.

After addressing the issue of already found bindings being lost due to indeterminacies in outer scopes (7e890bfa87) and adding one missing `Stage::Late` in `Finalize` the scope splitting refactoring just worked.
(One more ICE was revealed by the refactoring, but not caused by it, fixed up in the last commit.)

This is a part of implementation for the [Open API](https://rust-lang.github.io/rust-project-goals/2025h1/open-namespaces.html) proposal.
2026-01-04 21:14:04 +01:00
bors
e29fcf45e4 Auto merge of #150674 - matthiaskrgr:rollup-tnkgbcx, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#150554 (test: add regression cases for valtree hashing ICE)
 - rust-lang/rust#150597 (make specialization of `Vec::extend` and `VecDeque::extend_front` work for vec::IntoIter with any `Allocator`, not just `Global`)
 - rust-lang/rust#150619 (alloc: Move Cow impl to existing ones)
 - rust-lang/rust#150660 (THIR pattern building: Pass HIR nodes instead of loose types/spans)
 - rust-lang/rust#150671 (miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-04 16:58:33 +00:00
Matthias Krüger
2270553cbe
Rollup merge of #150554 - Dushyanthyadav:ice-issue-150409-regression-test, r=davidtwco
test: add regression cases for valtree hashing ICE

This PR extends the existing regression test `printing_valtrees_supports_non_values.rs` to cover cases that previously caused an ICE in `const_kind.rs` due to hashing inference variables.

It specifically adds:

A case where an associated constant is used without the required trait bound.

The `0: _` case as suggested in [Here](https://github.com/rust-lang/rust/issues/150409#issuecomment-3700022690)

Fixes rust-lang/rust#150409
2026-01-04 16:16:09 +01:00
Kivooeo
05afcb6d26 init impl 2026-01-04 15:12:39 +00:00
Manuel Drehwald
fa584faca5 Update test and verify that tgt_(un)register_lib have the right type 2026-01-04 06:58:31 -08:00
Stuart Cook
db41a1556e
Rollup merge of #150659 - mu001999-contrib:fix/150654, r=Urgau
Add missing translator resources for interface parse_cfg and parse_check_cfg

Missing resources leads to the failure of `translate_message`.

Fixes rust-lang/rust#150654
2026-01-04 21:37:05 +11:00
Stuart Cook
05dce482d3
Rollup merge of #150650 - enthropy7:main, r=BoxyUwU
Forbid generic parameters in types of #[type_const] items

fixes rust-lang/rust#150614

we enforce the same restriction on `#[type_const]` const items that already exists for const generic parameters - when `generic_const_parameter_types` feature gate is not enabled, the type of a `#[type_const]` item cannot reference generic parameters.  implementation follows the same pattern used for const generic parameters. we check if the item has the `#[type_const]` attribute and if the feature gate is disabled, then we apply `RibKind::ConstParamTy` restrictions when visiting the type, which prevents the use of generic parameters.

check is added in three places:
- Free const items (`ItemKind::Const`)
- Trait associated consts (`AssocItemKind::Const` in traits)
- Impl associated consts (`AssocItemKind::Const` in impls)

added tests for new feature, hope i get this task right :>

r? `@BoxyUwU`
2026-01-04 21:37:04 +11:00
Stuart Cook
336c6658e4
Rollup merge of #150201 - Enselic:debugger-tests-revisions-2, r=Zalathar
compiletest: Support revisions in debuginfo (read: debugger) tests

And start using revisions in `tests/debuginfo/macro-stepping.rs` to prevent regressing both with and without `SingleUseConsts` MIR pass.

I recommend commit-by-commit review.

## ~TODO~

- [x] Verify this more carefully.
- [x] Possibly do some preparatory PRs before taking this PR out of draft.
    - [x] Rebase on https://github.com/rust-lang/rust/pull/150205 once merged so we don't have to add another "`+ 1`".

## CC

CC ``@Zalathar`` since you might have opinions about that I expose a helper function to reduce duplication

CC ``@saethlin`` since this is what we will use for `tests/debuginfo/basic-stepping.rs` in https://github.com/rust-lang/rust/pull/147426 (in the same way I use it in `tests/debuginfo/macro-stepping.rs` here)
2026-01-04 21:37:02 +11:00
enthropy7
46bb414d69
Forbid generic parameters in types of #[type_const] items 2026-01-04 07:21:35 +03:00
mu001999
759857cce3 Add missing translator resources for interface parse_cfg and parse_check_cfg 2026-01-04 11:53:31 +08:00
bors
f57b9e6f56 Auto merge of #150564 - rwardd:rwardd/option_or_codegen_tests, r=scottmcm
Added codegen tests for different forms of `Option::or`

Adds tests to check the output of the different ways of writing `Option::or`

Fixes rust-lang/rust#124533
2026-01-03 22:47:35 +00:00
Matthias Krüger
7af208fe0b
Rollup merge of #150570 - Human9000-bit:main, r=jieyouxu
Removed confusing diagnostics note for trait required for `?` operator use

- **test: modified `bad-question-mark-on-trait-objects` to match expected behavior**
- **removed confusing message from diagnostics**

fixes [#150527](https://github.com/rust-lang/rust/issues/150527)
2026-01-03 10:09:29 +01:00
Matthias Krüger
78376fd39c
Rollup merge of #150558 - estebank:multiple-dep-versions, r=jieyouxu
Detect cases where `?` is applied on a type that could be coming from a different crate version than expected

```
error[E0277]: `?` couldn't convert the error to `dependency::Error`
  --> replaced
   |
LL | fn main() -> Result<(), Error> {
   |              ----------------- expected `dependency::Error` because of this
...
LL |     Err(Error2)?;
   |     -----------^ the trait `From<Error2>` is not implemented for `dependency::Error`
   |     |
   |     this can't be annotated with `?` because it has type `Result<_, Error2>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
help: the trait `From<Error2>` is not implemented for `dependency::Error`
      but trait `From<()>` is implemented for it
  --> replaced
   |
LL | impl From<()> for Error {
   | ^^^^^^^^^^^^^^^^^^^^^^^
   = help: for that trait implementation, expected `()`, found `Error2`
   = note: there are multiple different versions of crate `dependency` in the dependency graph
   = help: you can use `cargo tree` to explore your dependency tree
```

The existing checks rely on having access to the actual types/traits that diverged to detect they are called the same, come from different crates with the same name. The new check is less specific, merely looking to see if the crate name the involved type belongs has multiple crates.

CC rust-lang/rust#78552.
2026-01-03 10:09:29 +01:00
Ryan Ward
a2fcb0de18 fix: add CHECK directives to ret comments and be more pervasive with directive contents 2026-01-03 12:50:38 +10:30
Ryan
3df06f5083
fix: use std::num::NonZero instead of extern crate and extend information in CHECK- directives
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2026-01-03 10:53:54 +10:30
bors
e8f3cfc0de Auto merge of #150628 - JonathanBrouwer:rollup-zy040xr, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#149991 (Add checks for gpu-kernel calling conv)
 - rust-lang/rust#150047 (std: merge `sys::pal::common` and `sys_common` into `sys::helpers`)
 - rust-lang/rust#150441 (do not suggest method call removal if it changes receiver type)
 - rust-lang/rust#150616 (Update `browser-ui-test` version to `0.23.0`)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-02 23:01:27 +00:00
Jonathan Brouwer
03a0155db3
Rollup merge of #150616 - GuillaumeGomez:update-browser-ui-test, r=lolbinarycat
Update `browser-ui-test` version to `0.23.0`

It comes with new features like conditions and an update to `puppeteer`.
2026-01-02 23:13:22 +01:00
Jonathan Brouwer
ce43d6cd01
Rollup merge of #150441 - fee1-dead-contrib:push-smqzpwrpvqll, r=estebank
do not suggest method call removal if it changes receiver type

Fixes rust-lang/rust#149487, cc `@estebank`
2026-01-02 23:13:22 +01:00
Jonathan Brouwer
6268b9118e
Rollup merge of #149991 - Flakebi:gpu-kernel-cc, r=workingjubilee
Add checks for gpu-kernel calling conv

The `gpu-kernel` calling convention has several restrictions that were not enforced by the compiler until now.
Add the following restrictions:

1. Cannot be async
2. Cannot be called
3. Cannot return values, return type must be `()` or `!`
4. Arguments should be simple, i.e. passed by value. More complicated types can work when you know what you are doing, but it is rather unintuitive, one needs to know ABI/compiler internals.
5. Export name should be unmangled, either through `no_mangle` or `export_name`. Kernels are searched by name on the CPU side, having a mangled name makes it hard to find and probably almost always unintentional.

Tracking issue: rust-lang/rust#135467
amdgpu target tracking issue: rust-lang/rust#135024

``@workingjubilee,`` these should be all the restrictions we talked about a year ago.

cc ``@RDambrosio016`` ``@kjetilkjeka`` for nvptx
2026-01-02 23:13:21 +01:00
bors
85c8ff69cb Auto merge of #150606 - JonathanBrouwer:rollup-lue4jqz, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#150425 (mapping an error from cmd.spawn() in npm::install)
 - rust-lang/rust#150444 (Expose kernel launch options as offload intrinsic args)
 - rust-lang/rust#150495 (Correct hexagon "unwinder_private_data_size")
 - rust-lang/rust#150578 (Fix a typo in the docs of AsMut for rust-lang/rust#149609)
 - rust-lang/rust#150581 (mir_build: Separate match lowering for string-equality and scalar-equality)
 - rust-lang/rust#150594 (Fix typo in the docs of `CString::from_vec_with_nul`)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-02 19:45:27 +00:00
Guillaume Gomez
665781513e Fix changes coming from browser-ui-test version update 2026-01-02 20:21:44 +01:00
bors
5497a36a7f Auto merge of #149658 - Enselic:non-zero-opt, r=Mark-Simulacrum
tests/codegen-llvm/some-non-zero-from-atomic-optimization.rs: New test

Closes rust-lang/rust#60044 which has one 👍 and one ❤️  vote and just **E-needs-test**.
2026-01-02 16:29:24 +00:00
Vadim Petrochenkov
2e123aef70 resolve: Avoid additional ambiguities from splitting modules into two scopes 2026-01-02 15:31:09 +03:00
Vadim Petrochenkov
78c61beb48 resolve: Patch up an inconsistent resolution ICE revealed by the previous commit 2026-01-02 15:26:06 +03:00
Vadim Petrochenkov
0016a71747 resolve: Migrate one more special ambiguity for glob vs non-glob bindings
in the same module to the usual ambiguity infra in `resolve_ident_in_scope_set`
2026-01-02 15:25:56 +03:00
Vadim Petrochenkov
bcfbb5619c resolve: Migrate a special ambiguity for glob vs non-glob bindings
in the same module to the usual ambiguity infra in `resolve_ident_in_scope_set`
2026-01-02 15:11:14 +03:00
Vadim Petrochenkov
75d90094e7 resolve: Split Scope::Module into two scopes for non-glob and glob bindings 2026-01-02 15:02:03 +03:00
Marcelo Domínguez
58e2610f71 Expose workgroup/thread dims as intrinsic args 2026-01-02 11:50:32 +01:00
bors
1b4325211c Auto merge of #150582 - jhpratt:rollup-3mal3wc, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#150073 (Make `asm_experimental_arch` work in `allow_internal_unstable` macros)
 - rust-lang/rust#150445 (resolve: Preserve binding scopes in ambiguity errors)
 - rust-lang/rust#150580 (Document `panic!` in `Iterator::last` for rust-lang/rust#149707)

r? `@ghost`
`@rustbot` modify labels: rollup
2026-01-02 05:37:45 +00:00