From c56add0dcbf49f785b7d823070bc866adc883eb6 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Thu, 12 Nov 2020 19:20:47 +0100 Subject: [PATCH] cg: add explicit test for const param promotion --- src/test/ui/const-generics/promotion.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/test/ui/const-generics/promotion.rs diff --git a/src/test/ui/const-generics/promotion.rs b/src/test/ui/const-generics/promotion.rs new file mode 100644 index 0000000000000..ac568bb75f002 --- /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() -> &'static usize { + &(3 + N) +} + +fn main() { + assert_eq!(promotion_test::<13>(), &16); +}