about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-11-13 15:26:20 +0100
committerGitHub <noreply@github.com>2020-11-13 15:26:20 +0100
commit7ea8e32adb091a7cd342208eda5559652af57da6 (patch)
tree3ce41ac761985e0c05cf9e1e9ad791e955205c6c
parent22cc878d897d467a76bc8e301a8f1e669cb1e4d5 (diff)
parentc56add0dcbf49f785b7d823070bc866adc883eb6 (diff)
downloadrust-7ea8e32adb091a7cd342208eda5559652af57da6.tar.gz
rust-7ea8e32adb091a7cd342208eda5559652af57da6.zip
Rollup merge of #78996 - lcnr:cg-promotion, r=RalfJung
add explicit test for const param promotion

r? `@RalfJung`
-rw-r--r--src/test/ui/const-generics/promotion.rs11
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);
+}