Add a test for const arguments
This commit is contained in:
parent
a29eca5d82
commit
c7deb5bdc2
13
src/test/ui/const-generics/const-arg-in-fn.rs
Normal file
13
src/test/ui/const-generics/const-arg-in-fn.rs
Normal 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);
|
||||||
|
}
|
6
src/test/ui/const-generics/const-arg-in-fn.stderr
Normal file
6
src/test/ui/const-generics/const-arg-in-fn.stderr
Normal 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)]
|
||||||
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Reference in New Issue
Block a user