Add a test for const arguments

This commit is contained in:
varkor 2019-04-23 00:03:14 +01:00
parent a29eca5d82
commit c7deb5bdc2
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
fn const_u32_identity<const X: u32>() -> u32 {
X
}
fn main() {
let val = const_u32_identity::<18>();
assert_eq!(val, 18);
}

View File

@ -0,0 +1,6 @@
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> $DIR/const-arg-in-fn.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^