about summary refs log tree commit diff
path: root/src/test/ui/const-generics
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-13 22:32:40 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-04-13 22:37:20 +0200
commit50eb39757e471ed50ab34862af776f044c88222d (patch)
treeebff0ebf52af9ba20b6f0ac1df76e29b4e88b553 /src/test/ui/const-generics
parentc58c53274401acdc739f177aa3e408241e2e52d8 (diff)
downloadrust-50eb39757e471ed50ab34862af776f044c88222d.tar.gz
rust-50eb39757e471ed50ab34862af776f044c88222d.zip
allow const generics in const fn
Diffstat (limited to 'src/test/ui/const-generics')
-rw-r--r--src/test/ui/const-generics/const-fn-with-const-param.rs4
-rw-r--r--src/test/ui/const-generics/const-fn-with-const-param.stderr17
2 files changed, 4 insertions, 17 deletions
diff --git a/src/test/ui/const-generics/const-fn-with-const-param.rs b/src/test/ui/const-generics/const-fn-with-const-param.rs
index e9e236be556..3d8b77bcf7b 100644
--- a/src/test/ui/const-generics/const-fn-with-const-param.rs
+++ b/src/test/ui/const-generics/const-fn-with-const-param.rs
@@ -1,11 +1,11 @@
+// run-pass
 #![feature(const_generics)]
 //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
 
 const fn const_u32_identity<const X: u32>() -> u32 {
-    //~^ ERROR const parameters are not permitted in const functions
     X
 }
 
 fn main() {
-    println!("{:?}", const_u32_identity::<18>());
+    assert_eq!(const_u32_identity::<18>(), 18);
 }
diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr
index e944b02101e..64b9c18a8f5 100644
--- a/src/test/ui/const-generics/const-fn-with-const-param.stderr
+++ b/src/test/ui/const-generics/const-fn-with-const-param.stderr
@@ -1,23 +1,10 @@
-error: const parameters are not permitted in const functions
-  --> $DIR/const-fn-with-const-param.rs:4:1
-   |
-LL |   const fn const_u32_identity<const X: u32>() -> u32 {
-   |   ^----
-   |   |
-   |  _`const` because of this
-   | |
-LL | |
-LL | |     X
-LL | | }
-   | |_^
-
 warning: the feature `const_generics` is incomplete and may cause the compiler to crash
-  --> $DIR/const-fn-with-const-param.rs:1:12
+  --> $DIR/const-fn-with-const-param.rs:2:12
    |
 LL | #![feature(const_generics)]
    |            ^^^^^^^^^^^^^^
    |
    = note: `#[warn(incomplete_features)]` on by default
 
-error: aborting due to previous error; 1 warning emitted
+warning: 1 warning emitted