Skip to content

Commit f52039d

Browse files
committed
add regression test for #71169
1 parent 01f5dd3 commit f52039d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(const_generics)]
2+
#![allow(incomplete_features)]
3+
4+
fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
5+
//~^ ERROR the type of const parameters must not
6+
fn main() {
7+
const DATA: [u8; 4] = *b"ABCD";
8+
foo::<4, DATA>();
9+
//~^ ERROR constant expression depends on
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0770]: the type of const parameters must not depend on other generic parameters
2+
--> $DIR/issue-71169.rs:4:43
3+
|
4+
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
5+
| ^^^ the type must not depend on the parameter `LEN`
6+
7+
error: constant expression depends on a generic parameter
8+
--> $DIR/issue-71169.rs:8:14
9+
|
10+
LL | foo::<4, DATA>();
11+
| ^^^^
12+
|
13+
= note: this may fail depending on what value the parameter takes
14+
15+
error: aborting due to 2 previous errors
16+
17+
For more information about this error, try `rustc --explain E0770`.

0 commit comments

Comments
 (0)