diff options
| author | varkor <github@varkor.com> | 2019-04-23 00:03:14 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-05-01 23:11:19 +0100 |
| commit | c7deb5bdc2dead50d728c71a18095f088398b7db (patch) | |
| tree | 40a20637618cff7e9d3f3ae61daef21733d9297d | |
| parent | a29eca5d82d36bdbda5cccf317b9c0b3e33ed23d (diff) | |
| download | rust-c7deb5bdc2dead50d728c71a18095f088398b7db.tar.gz rust-c7deb5bdc2dead50d728c71a18095f088398b7db.zip | |
Add a test for const arguments
| -rw-r--r-- | src/test/ui/const-generics/const-arg-in-fn.rs | 13 | ||||
| -rw-r--r-- | src/test/ui/const-generics/const-arg-in-fn.stderr | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/const-arg-in-fn.rs b/src/test/ui/const-generics/const-arg-in-fn.rs new file mode 100644 index 00000000000..3f86782838c --- /dev/null +++ b/src/test/ui/const-generics/const-arg-in-fn.rs @@ -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); +} diff --git a/src/test/ui/const-generics/const-arg-in-fn.stderr b/src/test/ui/const-generics/const-arg-in-fn.stderr new file mode 100644 index 00000000000..e32b714b25d --- /dev/null +++ b/src/test/ui/const-generics/const-arg-in-fn.stderr @@ -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)] + | ^^^^^^^^^^^^^^ + |
