Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ded9f2e

Browse files
committed
Test anon consts in addition to path consts for repeat expr hack
1 parent 6052cc1 commit ded9f2e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

tests/ui/const-generics/repeat_expr_hack_gives_right_generics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ fn bar<const N: usize>() {}
1515
fn foo<const N: usize>() {
1616
bar::<{ [1; N] }>();
1717
//~^ ERROR: generic parameters may not be used in const operations
18+
bar::<{ [1; { N + 1 }] }>();
19+
//~^ ERROR: generic parameters may not be used in const operations
1820
}
1921

2022
fn main() {}

tests/ui/const-generics/repeat_expr_hack_gives_right_generics.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@ LL | bar::<{ [1; N] }>();
77
= help: const parameters may only be used as standalone arguments, i.e. `N`
88
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
99

10-
error: aborting due to 1 previous error
10+
error: generic parameters may not be used in const operations
11+
--> $DIR/repeat_expr_hack_gives_right_generics.rs:18:19
12+
|
13+
LL | bar::<{ [1; { N + 1 }] }>();
14+
| ^ cannot perform const operation using `N`
15+
|
16+
= help: const parameters may only be used as standalone arguments, i.e. `N`
17+
= help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
18+
19+
error: aborting due to 2 previous errors
1120

0 commit comments

Comments
 (0)