rust/tests
bors dc47a69ed9 Auto merge of #149136 - BoxyUwU:mgca_explicit_anon_consts, r=oli-obk
MGCA: Syntactically distinguish anon const const args

r? oli-obk

tracking issue: rust-lang/rust#132980

This PR requires that when `feature(min_generic_const_args)` is enabled, anon const const args are *syntactically* distinguishable from other kinds of args. We use `const { ... }` in const argument position to denote an anon const:
```rust
#![feature(min_generic_const_args)]

// no longer allowed as `1 + 1` is represented via an anon const and
// there is no syntactic marker
type Foo = [(); 1 + 1];

// allowed, `const { ... }` indicates an anon const representation
type Foo = [(); const { 1 + 1 }];
```

This restriction is only placed when mgca is enabled. There should be no effect on stable. This restriction is not enforced for unbraced literals which we continue to implicitly wrap in an anon const: `tests/ui/const-generics/mgca/explicit_anon_consts_literals_hack.rs`

This restriction allows us to create `DefId`s for anon consts only when actually required. When it is syntactically ambiguous whether a const argument is an anon const or not we are forced to conservatively create a `DefId` for every const argument even if it doesn't wind up needing one.

This works fine on stable but under `mgca` we can wind up with anon consts nested inside non-anon-const const arguments resulting in a broken `DefId` tree. See rust-lang/rust#148838 where an anon const arg inside of a path arg winds up with a parent of a conservatively created `DefId` that doesn't actually correspond to an anon const, resulting in an ICE.

With rust-lang/rust#149114 every field initialiser in a const argument would become a place where there could *possibly* be an anon const. This would also get worse once we support tuple constructors- now every function argument is a place where there could possibly be an anon const.

We introduce this restriction to avoid creating massive amounts of unused `DefId`s that make the parent tree significantly more complicated, and to avoid having to paper over this issue in things like `generics_of`.

Fixes rust-lang/rust#148838

It also must be syntactically clear from context whether `'_` means an inference lifetime or an elided lifetime parameter. This restriction will allow us to properly resolve `'_` in const arguments in mgca. This PR doesn't actually fix handle this, but we could do so trivially after this lands.
2025-12-12 21:35:31 +00:00
..
assembly-llvm Rollup merge of #149409 - cezarbbb:stable_ssp, r=SparrowLii 2025-11-29 21:12:26 +11:00
auxiliary Rework c_variadic 2025-12-04 10:51:34 +01:00
codegen-llvm Rollup merge of #149679 - pmur:murp/ppc-inline-improvements, r=Amanieu 2025-12-10 07:54:20 +01:00
codegen-units Add #[inline] to Layout::is_size_align_valid 2025-12-06 19:47:13 -06:00
coverage Auto merge of #142821 - cjgillot:jump-threading-single, r=saethlin 2025-12-01 23:44:49 +00:00
coverage-run-rustdoc
crashes mark crash test as requiring debug-assertions 2025-12-10 14:47:50 +00:00
debuginfo debuginfo/macro-stepping test: extend comments 2025-12-01 22:32:36 +01:00
incremental Add unsafe to no_mangle incremental tests 2025-12-03 17:00:22 +01:00
mir-opt Auto merge of #149426 - antoyo:libgccjit-targets, r=Kobzol 2025-12-09 01:58:46 +00:00
pretty Rollup merge of #149489 - scottmcm:try-bikeshed, r=nnethercote 2025-12-10 17:16:47 +01:00
run-make Rollup merge of #149565 - jyn514:force-doctest-merge, r=notriddle 2025-12-11 22:09:54 +01:00
run-make-cargo Skip the panic-immediate-abort-works test when cross-compiling 2025-09-22 21:13:38 -04:00
rustdoc Correctly iterate doc comments in intra-doc resolution in rustc_resolve 2025-12-10 12:28:07 +01:00
rustdoc-gui Make implementors list visible only when filled 2025-12-10 16:18:22 +01:00
rustdoc-js Auto merge of #149370 - Zalathar:rollup-6fkk5x4, r=Zalathar 2025-11-27 07:30:25 +00:00
rustdoc-js-std std: Use more unix.rs code on WASI targets 2025-12-08 06:46:28 -08:00
rustdoc-json Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-ui If there are too many suggestions for malformed attribute, do not suggest them 2025-12-12 14:55:17 +01:00
ui Auto merge of #149136 - BoxyUwU:mgca_explicit_anon_consts, r=oli-obk 2025-12-12 21:35:31 +00:00
ui-fulldeps Point at span within local macros even when error happens in nested external macro 2025-12-10 19:27:40 +00:00
COMPILER_TESTS.md