about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/const-expression-parameter.rs11
-rw-r--r--src/test/ui/const-generics/const-expression-parameter.stderr16
-rw-r--r--src/test/ui/const-generics/const-fn-with-const-param.rs1
-rw-r--r--src/test/ui/const-generics/const-fn-with-const-param.stderr9
-rw-r--r--src/test/ui/const-generics/const-param-before-other-params.rs4
-rw-r--r--src/test/ui/const-generics/const-param-before-other-params.stderr18
-rw-r--r--src/test/ui/const-generics/const-param-from-outer-fn.rs1
-rw-r--r--src/test/ui/const-generics/const-param-from-outer-fn.stderr11
-rw-r--r--src/test/ui/const-generics/const-parameter-uppercase-lint.rs4
-rw-r--r--src/test/ui/const-generics/const-parameter-uppercase-lint.stderr17
-rw-r--r--src/test/ui/derives/deriving-with-repr-packed.stderr4
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_generics.rs2
-rw-r--r--src/test/ui/feature-gates/feature-gate-const_generics.stderr16
13 files changed, 33 insertions, 81 deletions
diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs
index f4e9008dbd0..662c7b767ba 100644
--- a/src/test/ui/const-generics/const-expression-parameter.rs
+++ b/src/test/ui/const-generics/const-expression-parameter.rs
@@ -1,23 +1,22 @@
 #![feature(const_generics)]
 //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
 
-fn u32_identity<const X: u32>() -> u32 {
-    //~^ ERROR const generics in any position are currently unsupported
+fn i32_identity<const X: i32>() -> i32 {
     5
 }
 
 fn foo_a() {
-    u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
+    i32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
 }
 
 fn foo_b() {
-    u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
+    i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
 }
 
 fn foo_c() {
-    u32_identity::< -1 >(); // ok
+    i32_identity::< -1 >(); // ok
 }
 
 fn main() {
-    u32_identity::<5>(); // ok
+    i32_identity::<5>(); // ok
 }
diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr
index 1dd3a960316..2741d621256 100644
--- a/src/test/ui/const-generics/const-expression-parameter.stderr
+++ b/src/test/ui/const-generics/const-expression-parameter.stderr
@@ -1,13 +1,13 @@
 error: expected identifier, found `<-`
-  --> $DIR/const-expression-parameter.rs:10:19
+  --> $DIR/const-expression-parameter.rs:9:19
    |
-LL |     u32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
+LL |     i32_identity::<-1>(); //~ ERROR expected identifier, found `<-`
    |                   ^^ expected identifier
 
 error: expected one of `,` or `>`, found `+`
-  --> $DIR/const-expression-parameter.rs:14:22
+  --> $DIR/const-expression-parameter.rs:13:22
    |
-LL |     u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
+LL |     i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+`
    |                      ^ expected one of `,` or `>` here
 
 warning: the feature `const_generics` is incomplete and may cause the compiler to crash
@@ -16,11 +16,5 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
 LL | #![feature(const_generics)]
    |            ^^^^^^^^^^^^^^
 
-error: const generics in any position are currently unsupported
-  --> $DIR/const-expression-parameter.rs:4:23
-   |
-LL | fn u32_identity<const X: u32>() -> u32 {
-   |                       ^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
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 052d723d96e..f36bf3875c3 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
@@ -3,7 +3,6 @@
 
 const fn const_u32_identity<const X: u32>() -> u32 {
     //~^ ERROR const parameters are not permitted in `const fn`
-    //~^^ ERROR const generics in any position are currently unsupported
     X
 }
 
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 a08ebfb0d97..94d2afa25b4 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
@@ -9,16 +9,9 @@ error: const parameters are not permitted in `const fn`
    |
 LL | / const fn const_u32_identity<const X: u32>() -> u32 {
 LL | |     //~^ ERROR const parameters are not permitted in `const fn`
-LL | |     //~^^ ERROR const generics in any position are currently unsupported
 LL | |     X
 LL | | }
    | |_^
 
-error: const generics in any position are currently unsupported
-  --> $DIR/const-fn-with-const-param.rs:4:35
-   |
-LL | const fn const_u32_identity<const X: u32>() -> u32 {
-   |                                   ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs
index 47f826789e0..188b5dce31e 100644
--- a/src/test/ui/const-generics/const-param-before-other-params.rs
+++ b/src/test/ui/const-generics/const-param-before-other-params.rs
@@ -1,14 +1,12 @@
 #![feature(const_generics)]
 //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
 
-fn foo<const X: (), T>(_: T) {
+fn foo<const X: (), T>(_: &T) {
     //~^ ERROR type parameters must be declared prior to const parameters
-    //~^^ ERROR const generics in any position are currently unsupported
 }
 
 fn bar<const X: (), 'a>(_: &'a ()) {
     //~^ ERROR lifetime parameters must be declared prior to const parameters
-    //~^^ ERROR const generics in any position are currently unsupported
 }
 
 fn main() {}
diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr
index a43415d0e5a..78f129e79ea 100644
--- a/src/test/ui/const-generics/const-param-before-other-params.stderr
+++ b/src/test/ui/const-generics/const-param-before-other-params.stderr
@@ -7,26 +7,14 @@ LL | #![feature(const_generics)]
 error: type parameters must be declared prior to const parameters
   --> $DIR/const-param-before-other-params.rs:4:21
    |
-LL | fn foo<const X: (), T>(_: T) {
+LL | fn foo<const X: (), T>(_: &T) {
    |       --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>`
 
 error: lifetime parameters must be declared prior to const parameters
-  --> $DIR/const-param-before-other-params.rs:9:21
+  --> $DIR/const-param-before-other-params.rs:8:21
    |
 LL | fn bar<const X: (), 'a>(_: &'a ()) {
    |       --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>`
 
-error: const generics in any position are currently unsupported
-  --> $DIR/const-param-before-other-params.rs:4:14
-   |
-LL | fn foo<const X: (), T>(_: T) {
-   |              ^
-
-error: const generics in any position are currently unsupported
-  --> $DIR/const-param-before-other-params.rs:9:14
-   |
-LL | fn bar<const X: (), 'a>(_: &'a ()) {
-   |              ^
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.rs b/src/test/ui/const-generics/const-param-from-outer-fn.rs
index 5a8dd92086f..6534bcf5ce6 100644
--- a/src/test/ui/const-generics/const-param-from-outer-fn.rs
+++ b/src/test/ui/const-generics/const-param-from-outer-fn.rs
@@ -2,7 +2,6 @@
 //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
 
 fn foo<const X: u32>() {
-    //~^ ERROR const generics in any position are currently unsupported
     fn bar() -> u32 {
         X //~ ERROR can't use generic parameters from outer function
     }
diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr
index b238b3a2aa4..f40b527d716 100644
--- a/src/test/ui/const-generics/const-param-from-outer-fn.stderr
+++ b/src/test/ui/const-generics/const-param-from-outer-fn.stderr
@@ -5,22 +5,15 @@ LL | #![feature(const_generics)]
    |            ^^^^^^^^^^^^^^
 
 error[E0401]: can't use generic parameters from outer function
-  --> $DIR/const-param-from-outer-fn.rs:7:9
+  --> $DIR/const-param-from-outer-fn.rs:6:9
    |
 LL | fn foo<const X: u32>() {
    |              - const variable from outer function
-LL |     //~^ ERROR const generics in any position are currently unsupported
 LL |     fn bar() -> u32 {
    |        --- try adding a local generic parameter in this method instead
 LL |         X //~ ERROR can't use generic parameters from outer function
    |         ^ use of generic parameter from outer function
 
-error: const generics in any position are currently unsupported
-  --> $DIR/const-param-from-outer-fn.rs:4:14
-   |
-LL | fn foo<const X: u32>() {
-   |              ^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0401`.
diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs
index 37fe9af98b3..164205dd75c 100644
--- a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs
+++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs
@@ -4,5 +4,7 @@
 #![deny(non_upper_case_globals)]
 
 fn noop<const x: u32>() {
-    //~^ ERROR const generics in any position are currently unsupported
+    //~^ ERROR const parameter `x` should have an upper case name
 }
+
+fn main() {}
diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr
index 9683e91cef3..190798d202b 100644
--- a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr
+++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr
@@ -4,16 +4,17 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t
 LL | #![feature(const_generics)]
    |            ^^^^^^^^^^^^^^
 
-error[E0601]: `main` function not found in crate `const_parameter_uppercase_lint`
-   |
-   = note: consider adding a `main` function to `$DIR/const-parameter-uppercase-lint.rs`
-
-error: const generics in any position are currently unsupported
+error: const parameter `x` should have an upper case name
   --> $DIR/const-parameter-uppercase-lint.rs:6:15
    |
 LL | fn noop<const x: u32>() {
-   |               ^
+   |               ^ help: convert the identifier to upper case: `X`
+   |
+note: lint level defined here
+  --> $DIR/const-parameter-uppercase-lint.rs:4:9
+   |
+LL | #![deny(non_upper_case_globals)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr
index 4ab14a1df84..9d96908a056 100644
--- a/src/test/ui/derives/deriving-with-repr-packed.stderr
+++ b/src/test/ui/derives/deriving-with-repr-packed.stderr
@@ -1,4 +1,4 @@
-error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133)
+error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133)
   --> $DIR/deriving-with-repr-packed.rs:8:16
    |
 LL | #[derive(Copy, Clone, PartialEq, Eq)]
@@ -12,7 +12,7 @@ LL | #![deny(safe_packed_borrows)]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
 
-error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133)
+error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133)
   --> $DIR/deriving-with-repr-packed.rs:8:23
    |
 LL | #[derive(Copy, Clone, PartialEq, Eq)]
diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.rs b/src/test/ui/feature-gates/feature-gate-const_generics.rs
index 907e00b11e5..fe1ded1c4bb 100644
--- a/src/test/ui/feature-gates/feature-gate-const_generics.rs
+++ b/src/test/ui/feature-gates/feature-gate-const_generics.rs
@@ -1,7 +1,5 @@
 fn foo<const X: ()>() {} //~ ERROR const generics are unstable
-//~^ const generics in any position are currently unsupported
 
 struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
-//~^ const generics in any position are currently unsupported
 
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr
index 3ab1aa2367f..bd86a4197a7 100644
--- a/src/test/ui/feature-gates/feature-gate-const_generics.stderr
+++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr
@@ -7,25 +7,13 @@ LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
    = help: add #![feature(const_generics)] to the crate attributes to enable
 
 error[E0658]: const generics are unstable (see issue #44580)
-  --> $DIR/feature-gate-const_generics.rs:4:18
+  --> $DIR/feature-gate-const_generics.rs:3:18
    |
 LL | struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
    |                  ^
    |
    = help: add #![feature(const_generics)] to the crate attributes to enable
 
-error: const generics in any position are currently unsupported
-  --> $DIR/feature-gate-const_generics.rs:1:14
-   |
-LL | fn foo<const X: ()>() {} //~ ERROR const generics are unstable
-   |              ^
-
-error: const generics in any position are currently unsupported
-  --> $DIR/feature-gate-const_generics.rs:4:18
-   |
-LL | struct Foo<const X: usize>([(); X]); //~ ERROR const generics are unstable
-   |                  ^
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.