move array test to diff file

This commit is contained in:
biscuitrescue
2026-02-16 01:35:50 +05:30
parent 68c705d12c
commit 7030be68ae
4 changed files with 35 additions and 23 deletions
@@ -0,0 +1,16 @@
#![feature(min_generic_const_args, adt_const_params, unsized_const_params)]
#![expect(incomplete_features)]
trait Trait {
type const ASSOC: usize;
}
fn takes_array<const A: [u32; 2]>() {}
fn takes_tuple_with_array<const A: ([u32; 2], u32)>() {}
fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
takes_array::<{ [N, N + 1] }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
takes_tuple_with_array::<{ ([N, N + 1], N) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
}
fn main() {}
@@ -0,0 +1,14 @@
error: complex const arguments must be placed inside of a `const` block
--> $DIR/array_expr_arg_complex.rs:12:25
|
LL | takes_array::<{ [N, N + 1] }>();
| ^^^^^
error: complex const arguments must be placed inside of a `const` block
--> $DIR/array_expr_arg_complex.rs:13:37
|
LL | takes_tuple_with_array::<{ ([N, N + 1], N) }>();
| ^^^^^
error: aborting due to 2 previous errors
@@ -2,14 +2,11 @@
#![expect(incomplete_features)]
trait Trait {
type const ASSOC: usize;
}
fn takes_tuple<const A: (u32, u32)>() {}
fn takes_nested_tuple<const A: (u32, (u32, u32))>() {}
fn takes_array<const A: [u32; 2]>() {}
fn takes_tuple_with_array<const A: ([u32; 2], u32)>() {}
fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
takes_tuple::<{ (N, N + 1) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
@@ -17,9 +14,6 @@ fn generic_caller<T: Trait, const N: u32, const N2: u32>() {
takes_nested_tuple::<{ (N, (N, N + 1)) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>(); //~ ERROR generic parameters may not be used in const operations
takes_array::<{ [N, N + 1] }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
takes_tuple_with_array::<{ ([N, N + 1], N) }>(); //~ ERROR complex const arguments must be placed inside of a `const` block
}
fn main() {}
@@ -1,40 +1,28 @@
error: complex const arguments must be placed inside of a `const` block
--> $DIR/tuple_expr_arg_complex.rs:15:25
--> $DIR/tuple_expr_arg_complex.rs:12:25
|
LL | takes_tuple::<{ (N, N + 1) }>();
| ^^^^^
error: complex const arguments must be placed inside of a `const` block
--> $DIR/tuple_expr_arg_complex.rs:16:25
--> $DIR/tuple_expr_arg_complex.rs:13:25
|
LL | takes_tuple::<{ (N, T::ASSOC + 1) }>();
| ^^^^^^^^^^^^
error: complex const arguments must be placed inside of a `const` block
--> $DIR/tuple_expr_arg_complex.rs:18:36
--> $DIR/tuple_expr_arg_complex.rs:15:36
|
LL | takes_nested_tuple::<{ (N, (N, N + 1)) }>();
| ^^^^^
error: complex const arguments must be placed inside of a `const` block
--> $DIR/tuple_expr_arg_complex.rs:21:25
|
LL | takes_array::<{ [N, N + 1] }>();
| ^^^^^
error: complex const arguments must be placed inside of a `const` block
--> $DIR/tuple_expr_arg_complex.rs:22:37
|
LL | takes_tuple_with_array::<{ ([N, N + 1], N) }>();
| ^^^^^
error: generic parameters may not be used in const operations
--> $DIR/tuple_expr_arg_complex.rs:19:44
--> $DIR/tuple_expr_arg_complex.rs:16:44
|
LL | takes_nested_tuple::<{ (N, (N, const { N + 1 })) }>();
| ^
|
= help: add `#![feature(opaque_generic_const_args)]` to allow generic expressions as the RHS of const items
error: aborting due to 6 previous errors
error: aborting due to 4 previous errors