]> git.lizzy.rs Git - rust.git/commitdiff
Add revisions to const generic const_evaluatable_checked tests.
authorHameer Abbasi <einstein.edison@gmail.com>
Fri, 11 Sep 2020 09:42:32 +0000 (11:42 +0200)
committerHameer Abbasi <einstein.edison@gmail.com>
Fri, 11 Sep 2020 09:42:32 +0000 (11:42 +0200)
src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.full.stderr [new file with mode: 0644]
src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr [new file with mode: 0644]
src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.rs
src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.stderr [deleted file]
src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr [new file with mode: 0644]
src/test/ui/const-generics/const_evaluatable_checked/simple.rs
src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr [new file with mode: 0644]
src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr [new file with mode: 0644]
src/test/ui/const-generics/const_evaluatable_checked/simple_fail.rs
src/test/ui/const-generics/const_evaluatable_checked/simple_fail.stderr [deleted file]

diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.full.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.full.stderr
new file mode 100644 (file)
index 0000000..b281636
--- /dev/null
@@ -0,0 +1,10 @@
+error: constant expression depends on a generic parameter
+  --> $DIR/feature-gate-const_evaluatable_checked.rs:9:30
+   |
+LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
+   |                              ^^^^^^
+   |
+   = note: this may fail depending on what value the parameter takes
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.min.stderr
new file mode 100644 (file)
index 0000000..269710d
--- /dev/null
@@ -0,0 +1,10 @@
+error: generic parameters must not be used inside of non trivial constant values
+  --> $DIR/feature-gate-const_evaluatable_checked.rs:6:33
+   |
+LL | type Arr<const N: usize> = [u8; N - 1];
+   |                                 ^ non-trivial anonymous constants must not depend on the parameter `N`
+   |
+   = help: it is currently only allowed to use either `N` or `{ N }` as generic constants
+
+error: aborting due to previous error
+
index 941bd5e9e5d0a984e894258e5b427ba210f1d424..af3090115f24a8cc2c717164aae16c55017cb6eb 100644 (file)
@@ -1,10 +1,13 @@
-#![feature(const_generics)]
-#![allow(incomplete_features)]
+// revisions: full min
+#![cfg_attr(full, feature(const_generics))]
+#![cfg_attr(full, allow(incomplete_features))]
+#![cfg_attr(min, feature(min_const_generics))]
 
 type Arr<const N: usize> = [u8; N - 1];
+//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
 
 fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
-    //~^ ERROR constant expression depends
+    //[full]~^ ERROR constant expression depends
     Default::default()
 }
 
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.stderr b/src/test/ui/const-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.stderr
deleted file mode 100644 (file)
index 6e4a22a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-error: constant expression depends on a generic parameter
-  --> $DIR/feature-gate-const_evaluatable_checked.rs:6:30
-   |
-LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
-   |                              ^^^^^^
-   |
-   = note: this may fail depending on what value the parameter takes
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple.min.stderr
new file mode 100644 (file)
index 0000000..da8ccda
--- /dev/null
@@ -0,0 +1,10 @@
+error: generic parameters must not be used inside of non trivial constant values
+  --> $DIR/simple.rs:8:33
+   |
+LL | type Arr<const N: usize> = [u8; N - 1];
+   |                                 ^ non-trivial anonymous constants must not depend on the parameter `N`
+   |
+   = help: it is currently only allowed to use either `N` or `{ N }` as generic constants
+
+error: aborting due to previous error
+
index a7ead78b97bae186d96452d1cc41fd03c665559d..27dc6b103200dc696517156b828103735d1bca33 100644 (file)
@@ -1,8 +1,12 @@
-// run-pass
-#![feature(const_generics, const_evaluatable_checked)]
+// [full] run-pass
+// revisions: full min
+#![cfg_attr(full, feature(const_generics))]
+#![cfg_attr(min, feature(min_const_generics))]
+#![feature(const_evaluatable_checked)]
 #![allow(incomplete_features)]
 
 type Arr<const N: usize> = [u8; N - 1];
+//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
 
 fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
     Default::default()
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.full.stderr
new file mode 100644 (file)
index 0000000..104cab8
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/simple_fail.rs:7:33
+   |
+LL | type Arr<const N: usize> = [u8; N - 1];
+   |                                 ^^^^^ attempt to compute `0_usize - 1_usize` which would overflow
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.min.stderr
new file mode 100644 (file)
index 0000000..042710f
--- /dev/null
@@ -0,0 +1,10 @@
+error: generic parameters must not be used inside of non trivial constant values
+  --> $DIR/simple_fail.rs:7:33
+   |
+LL | type Arr<const N: usize> = [u8; N - 1];
+   |                                 ^ non-trivial anonymous constants must not depend on the parameter `N`
+   |
+   = help: it is currently only allowed to use either `N` or `{ N }` as generic constants
+
+error: aborting due to previous error
+
index 1edf1885dd28186325c928847f77a4a812067799..b15e0ff183954f7d5470eb491b9c7b4dc2c3a7f8 100644 (file)
@@ -1,7 +1,11 @@
-#![feature(const_generics, const_evaluatable_checked)]
+// revisions: full min
+#![cfg_attr(full, feature(const_generics))]
+#![cfg_attr(min, feature(min_const_generics))]
+#![feature(const_evaluatable_checked)]
 #![allow(incomplete_features)]
 
-type Arr<const N: usize> = [u8; N - 1]; //~ ERROR evaluation of constant
+type Arr<const N: usize> = [u8; N - 1]; //[full]~ ERROR evaluation of constant
+//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
 
 fn test<const N: usize>() -> Arr<N> where Arr<N>: Sized {
     todo!()
diff --git a/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.stderr b/src/test/ui/const-generics/const_evaluatable_checked/simple_fail.stderr
deleted file mode 100644 (file)
index 1ac5e1d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0080]: evaluation of constant value failed
-  --> $DIR/simple_fail.rs:4:33
-   |
-LL | type Arr<const N: usize> = [u8; N - 1];
-   |                                 ^^^^^ attempt to compute `0_usize - 1_usize` which would overflow
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0080`.