about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2020-04-20 14:01:59 +0100
committervarkor <github@varkor.com>2020-04-20 14:01:59 +0100
commitf8b796b10b3282b02a6bb6f5b5be9dc8dc0dbf94 (patch)
treed68b9c5c8ede05472801221634d81bc0dc2a1a74 /src/test
parent3eea7b31ee0f1afdfcbb2ece8a5445655706cd9b (diff)
downloadrust-f8b796b10b3282b02a6bb6f5b5be9dc8dc0dbf94.tar.gz
rust-f8b796b10b3282b02a6bb6f5b5be9dc8dc0dbf94.zip
Add error message for using type parameter as the type of a const parameter
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs2
-rw-r--r--src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr6
-rw-r--r--src/test/ui/const-generics/const-param-type-depends-on-type-param.rs2
-rw-r--r--src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr6
4 files changed, 10 insertions, 6 deletions
diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs
index 59bb06690a1..86ab8075896 100644
--- a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs
+++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.rs
@@ -1,6 +1,6 @@
 use std::marker::PhantomData;
 
 struct B<T, const N: T>(PhantomData<[T; N]>); //~ ERROR const generics are unstable
-//~^ ERROR `T` must be annotated with `#[derive(PartialEq, Eq)]`
+//~^ ERROR `T` is not guaranteed to `#[derive(PartialEq, Eq)]`
 
 fn main() {}
diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr
index 70f9fc4184c..92a7edf96bc 100644
--- a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr
+++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr
@@ -7,11 +7,13 @@ LL | struct B<T, const N: T>(PhantomData<[T; N]>);
    = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
    = help: add `#![feature(const_generics)]` to the crate attributes to enable
 
-error[E0741]: `T` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
+error[E0741]: `T` is not guaranteed to `#[derive(PartialEq, Eq)]`, so may not be used as the type of a const parameter
   --> $DIR/const-param-type-depends-on-type-param-ungated.rs:3:22
    |
 LL | struct B<T, const N: T>(PhantomData<[T; N]>);
-   |                      ^ `T` doesn't derive both `PartialEq` and `Eq`
+   |                      ^ `T` may not derive both `PartialEq` and `Eq`
+   |
+   = note: it is not currently possible to use a type parameter as the type of a const parameter
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs
index 4dcda3b87a8..7468020366c 100644
--- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs
+++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.rs
@@ -7,6 +7,6 @@
 // details.
 
 pub struct Dependent<T, const X: T>([(); X]);
-//~^ ERROR `T` must be annotated with `#[derive(PartialEq, Eq)]`
+//~^ ERROR `T` is not guaranteed to `#[derive(PartialEq, Eq)]`
 
 fn main() {}
diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr
index 290d53c4e19..9f20b06813e 100644
--- a/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr
+++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param.stderr
@@ -6,11 +6,13 @@ LL | #![feature(const_generics)]
    |
    = note: `#[warn(incomplete_features)]` on by default
 
-error[E0741]: `T` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
+error[E0741]: `T` is not guaranteed to `#[derive(PartialEq, Eq)]`, so may not be used as the type of a const parameter
   --> $DIR/const-param-type-depends-on-type-param.rs:9:34
    |
 LL | pub struct Dependent<T, const X: T>([(); X]);
-   |                                  ^ `T` doesn't derive both `PartialEq` and `Eq`
+   |                                  ^ `T` may not derive both `PartialEq` and `Eq`
+   |
+   = note: it is not currently possible to use a type parameter as the type of a const parameter
 
 error: aborting due to previous error; 1 warning emitted