diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-11-12 19:20:47 +0100 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-11-12 19:20:47 +0100 |
| commit | c56add0dcbf49f785b7d823070bc866adc883eb6 (patch) | |
| tree | 0bf535d72516eff339fd625cca47df6a2c8ed826 | |
| parent | 12f0dba618e761c987142474435dff95ab177f3c (diff) | |
| download | rust-c56add0dcbf49f785b7d823070bc866adc883eb6.tar.gz rust-c56add0dcbf49f785b7d823070bc866adc883eb6.zip | |
cg: add explicit test for const param promotion
| -rw-r--r-- | src/test/ui/const-generics/promotion.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/promotion.rs b/src/test/ui/const-generics/promotion.rs new file mode 100644 index 00000000000..ac568bb75f0 --- /dev/null +++ b/src/test/ui/const-generics/promotion.rs @@ -0,0 +1,11 @@ +// run-pass +// tests that promoting expressions containing const parameters is allowed. +#![feature(min_const_generics)] + +fn promotion_test<const N: usize>() -> &'static usize { + &(3 + N) +} + +fn main() { + assert_eq!(promotion_test::<13>(), &16); +} |
