Add a test for incorrect numbers of const args
This commit is contained in:
parent
16d6ee3952
commit
a188850ded
11
src/test/ui/const-generics/incorrect-number-of-const-args.rs
Normal file
11
src/test/ui/const-generics/incorrect-number-of-const-args.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
fn foo<const X: usize, const Y: usize>() -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo::<0>(); //~ ERROR wrong number of const arguments: expected 2, found 1
|
||||
foo::<0, 0, 0>(); //~ ERROR wrong number of const arguments: expected 2, found 3
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/incorrect-number-of-const-args.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 2, found 1
|
||||
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
||||
|
|
||||
LL | foo::<0>();
|
||||
| ^^^^^^^^ expected 2 const arguments
|
||||
|
||||
error[E0107]: wrong number of const arguments: expected 2, found 3
|
||||
--> $DIR/incorrect-number-of-const-args.rs:10:17
|
||||
|
|
||||
LL | foo::<0, 0, 0>();
|
||||
| ^ unexpected const argument
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0107`.
|
Loading…
Reference in New Issue
Block a user