forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add regression test for rust-lang#71169
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
fn foo<const LEN: usize, const DATA: [u8; LEN]>() {} | ||
//~^ ERROR the type of const parameters must not | ||
fn main() { | ||
const DATA: [u8; 4] = *b"ABCD"; | ||
foo::<4, DATA>(); | ||
//~^ ERROR constant expression depends on | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error[E0770]: the type of const parameters must not depend on other generic parameters | ||
--> $DIR/issue-71169.rs:4:43 | ||
| | ||
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {} | ||
| ^^^ the type must not depend on the parameter `LEN` | ||
|
||
error: constant expression depends on a generic parameter | ||
--> $DIR/issue-71169.rs:8:14 | ||
| | ||
LL | foo::<4, DATA>(); | ||
| ^^^^ | ||
| | ||
= note: this may fail depending on what value the parameter takes | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0770`. |