]> git.lizzy.rs Git - rust.git/commitdiff
change const param ty warning message
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Tue, 18 Aug 2020 20:44:06 +0000 (22:44 +0200)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Tue, 18 Aug 2020 20:44:06 +0000 (22:44 +0200)
27 files changed:
src/librustc_typeck/check/wfcheck.rs
src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr
src/test/ui/const-generics/array-size-in-generic-struct-param.rs
src/test/ui/const-generics/const-param-elided-lifetime.min.stderr
src/test/ui/const-generics/const-param-elided-lifetime.rs
src/test/ui/const-generics/const-param-type-depends-on-const-param.min.stderr
src/test/ui/const-generics/const-param-type-depends-on-const-param.rs
src/test/ui/const-generics/different_byref.min.stderr
src/test/ui/const-generics/different_byref.rs
src/test/ui/const-generics/fn-const-param-call.min.stderr
src/test/ui/const-generics/fn-const-param-infer.min.stderr
src/test/ui/const-generics/forbid-non-structural_match-types.min.stderr
src/test/ui/const-generics/forbid-non-structural_match-types.rs
src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr
src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.rs
src/test/ui/const-generics/issues/issue-74950.min.stderr
src/test/ui/const-generics/issues/issue-74950.rs
src/test/ui/const-generics/min_const_generics/complex-types.rs
src/test/ui/const-generics/min_const_generics/complex-types.stderr
src/test/ui/const-generics/nested-type.full.stderr
src/test/ui/const-generics/nested-type.min.stderr
src/test/ui/const-generics/nested-type.rs
src/test/ui/const-generics/raw-ptr-const-param-deref.min.stderr
src/test/ui/const-generics/raw-ptr-const-param.min.stderr
src/test/ui/const-generics/slice-const-param-mismatch.min.stderr
src/test/ui/const-generics/slice-const-param.min.stderr
src/test/ui/const-generics/slice-const-param.rs

index cbf302ad71005c5e4b7ab2f2a1cf39ee9f1b6dd4..810bf59ea6c35ad936da1cbcdd6266520379b658 100644 (file)
@@ -289,12 +289,14 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
             let ty = tcx.type_of(tcx.hir().local_def_id(param.hir_id));
 
             let err_ty_str;
+            let mut is_ptr = true;
             let err = if tcx.features().min_const_generics {
                 match ty.kind {
                     ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Error(_) => None,
                     ty::FnPtr(_) => Some("function pointers"),
                     ty::RawPtr(_) => Some("raw pointers"),
                     _ => {
+                        is_ptr = false;
                         err_ty_str = format!("`{}`", ty);
                         Some(err_ty_str.as_str())
                     }
@@ -307,19 +309,29 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
                 }
             };
             if let Some(unsupported_type) = err {
-                let mut err = tcx.sess.struct_span_err(
-                    hir_ty.span,
-                    &format!("using {} as const generic parameters is forbidden", unsupported_type),
-                );
-
-                if tcx.features().min_const_generics {
-                    err.note("the only supported types are integers, `bool` and `char`")
+                if is_ptr {
+                    tcx.sess.span_err(
+                        hir_ty.span,
+                        &format!(
+                            "using {} as const generic parameters is forbidden",
+                            unsupported_type
+                        ),
+                    )
+                } else {
+                    tcx.sess
+                        .struct_span_err(
+                            hir_ty.span,
+                            &format!(
+                                "{} is forbidden as the type of a const generic parameter",
+                                unsupported_type
+                            ),
+                        )
+                        .note("the only supported types are integers, `bool` and `char`")
                         .note("more complex types are supported with `#[feature(const_generics)]`")
                         .emit()
-                } else {
-                    err.emit();
                 }
             };
+
             if traits::search_for_structural_match_violation(param.hir_id, param.span, tcx, ty)
                 .is_some()
             {
index 61d23475c6f79b72cb44111651249c7f5c039745..809514e8a1c9da2ecdebddeb3cbf309a61eb098a 100644 (file)
@@ -14,7 +14,7 @@ LL |     arr: [u8; CFG.arr_size],
    |
    = help: it is currently only allowed to use either `CFG` or `{ CFG }` as generic constants
 
-error: using `Config` as const generic parameters is forbidden
+error: `Config` is forbidden as the type of a const generic parameter
   --> $DIR/array-size-in-generic-struct-param.rs:18:21
    |
 LL | struct B<const CFG: Config> {
index aa1a3b9cf28889dd13c7971671978c196831fe31..8bd3b78725957785ddf5f7509e52e60c0d020fdd 100644 (file)
@@ -16,7 +16,7 @@ struct Config {
 }
 
 struct B<const CFG: Config> {
-    //[min]~^ ERROR using `Config` as const generic parameters is forbidden
+    //[min]~^ ERROR `Config` is forbidden
     arr: [u8; CFG.arr_size],
     //[full]~^ ERROR constant expression depends on a generic parameter
     //[min]~^^ ERROR generic parameters must not be used inside of non trivial
index bdd1da96c756536ed9a8670835db29b1a43103fb..81dbaee0ec514ff062cd597731958f1d6d483e59 100644 (file)
@@ -28,7 +28,7 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
 LL | fn bar<const N: &u8>() {}
    |                 ^ explicit lifetime name needed here
 
-error: using `&'static u8` as const generic parameters is forbidden
+error: `&'static u8` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-elided-lifetime.rs:11:19
    |
 LL | struct A<const N: &u8>;
@@ -37,7 +37,7 @@ LL | struct A<const N: &u8>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static u8` as const generic parameters is forbidden
+error: `&'static u8` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-elided-lifetime.rs:16:15
    |
 LL | impl<const N: &u8> A<N> {
@@ -46,7 +46,7 @@ LL | impl<const N: &u8> A<N> {
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static u8` as const generic parameters is forbidden
+error: `&'static u8` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-elided-lifetime.rs:24:15
    |
 LL | impl<const N: &u8> B for A<N> {}
@@ -55,7 +55,7 @@ LL | impl<const N: &u8> B for A<N> {}
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static u8` as const generic parameters is forbidden
+error: `&'static u8` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-elided-lifetime.rs:28:17
    |
 LL | fn bar<const N: &u8>() {}
@@ -64,7 +64,7 @@ LL | fn bar<const N: &u8>() {}
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static u8` as const generic parameters is forbidden
+error: `&'static u8` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-elided-lifetime.rs:19:21
    |
 LL |     fn foo<const M: &u8>(&self) {}
index 814b71d4b741f8e5fcf8359223c70773d51d8956..633e876f1d7dd29c054eed348a3c317a848fc591 100644 (file)
 
 struct A<const N: &u8>;
 //~^ ERROR `&` without an explicit lifetime name cannot be used here
-//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
+//[min]~^^ ERROR `&'static u8` is forbidden
 trait B {}
 
 impl<const N: &u8> A<N> {
 //~^ ERROR `&` without an explicit lifetime name cannot be used here
-//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
+//[min]~^^ ERROR `&'static u8` is forbidden
     fn foo<const M: &u8>(&self) {}
     //~^ ERROR `&` without an explicit lifetime name cannot be used here
-    //[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
+    //[min]~^^ ERROR `&'static u8` is forbidden
 }
 
 impl<const N: &u8> B for A<N> {}
 //~^ ERROR `&` without an explicit lifetime name cannot be used here
-//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
+//[min]~^^ ERROR `&'static u8` is forbidden
 
 fn bar<const N: &u8>() {}
 //~^ ERROR `&` without an explicit lifetime name cannot be used here
-//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
+//[min]~^^ ERROR `&'static u8` is forbidden
 
 fn main() {}
index 103f4c36faef32d6b8e0d1558a6b8b699ad5a043..b00a160787629a1be9be1ba90b4de8e57d82592a 100644 (file)
@@ -10,7 +10,7 @@ error[E0770]: the type of const parameters must not depend on other generic para
 LL | pub struct SelfDependent<const N: [u8; N]>;
    |                                        ^ the type must not depend on the parameter `N`
 
-error: using `[u8; _]` as const generic parameters is forbidden
+error: `[u8; _]` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-type-depends-on-const-param.rs:12:47
    |
 LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
@@ -19,7 +19,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `[u8; _]` as const generic parameters is forbidden
+error: `[u8; _]` is forbidden as the type of a const generic parameter
   --> $DIR/const-param-type-depends-on-const-param.rs:16:35
    |
 LL | pub struct SelfDependent<const N: [u8; N]>;
index d21a7cec117ee43cd4f7175a9a3f5678db3b340d..29371eeb21d1cf0721c0370982eb6009d6f1a910 100644 (file)
 
 pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
 //~^ ERROR: the type of const parameters must not depend on other generic parameters
-//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden
+//[min]~^^ ERROR `[u8; _]` is forbidden
 
 pub struct SelfDependent<const N: [u8; N]>;
 //~^ ERROR: the type of const parameters must not depend on other generic parameters
-//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden
+//[min]~^^ ERROR `[u8; _]` is forbidden
 
 fn main() {}
index 770491179abb53f1663dfd3b3db849e12c55606b..050b28abe5088168cdc1c8f402489ed3d7a1d6f9 100644 (file)
@@ -1,4 +1,4 @@
-error: using `[usize; 1]` as const generic parameters is forbidden
+error: `[usize; 1]` is forbidden as the type of a const generic parameter
   --> $DIR/different_byref.rs:8:23
    |
 LL | struct Const<const V: [usize; 1]> {}
index ec85ed775d4f5debdc24da912e4ac961f36c10c9..cd3960eeb8e0d16cab324fcfe6468f020ca149cb 100644 (file)
@@ -6,7 +6,7 @@
 #![cfg_attr(min, feature(min_const_generics))]
 
 struct Const<const V: [usize; 1]> {}
-//[min]~^ using `[usize; 1]` as const generic parameters is forbidden
+//[min]~^ ERROR `[usize; 1]` is forbidden
 
 fn main() {
     let mut x = Const::<{ [3] }> {};
index 83acd04e4640bd0dba75ec9e3fc9983d9e5b7fac..f1bd8def9ff161cf89c88289aaf01f5315ab2bba 100644 (file)
@@ -3,18 +3,12 @@ error: using function pointers as const generic parameters is forbidden
    |
 LL | struct Wrapper<const F: fn() -> u32>;
    |                         ^^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: using function pointers as const generic parameters is forbidden
   --> $DIR/fn-const-param-call.rs:14:15
    |
 LL | impl<const F: fn() -> u32> Wrapper<F> {
    |               ^^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: aborting due to 2 previous errors
 
index 27d1101cbcb055ef890344470753f8fdf55bccbd..4bdc9b89af607d25e63f90cbbb4292a034dd1c39 100644 (file)
@@ -3,9 +3,6 @@ error: using function pointers as const generic parameters is forbidden
    |
 LL | struct Checked<const F: fn(usize) -> bool>;
    |                         ^^^^^^^^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: aborting due to previous error
 
index 25aa354022304436dbe557260718fb548dae8e41..40d8f44cafc04c8f5dc1d678c4e6849de2b30ce8 100644 (file)
@@ -1,4 +1,4 @@
-error: using `A` as const generic parameters is forbidden
+error: `A` is forbidden as the type of a const generic parameter
   --> $DIR/forbid-non-structural_match-types.rs:10:19
    |
 LL | struct B<const X: A>; // ok
@@ -7,7 +7,7 @@ LL | struct B<const X: A>; // ok
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `C` as const generic parameters is forbidden
+error: `C` is forbidden as the type of a const generic parameter
   --> $DIR/forbid-non-structural_match-types.rs:15:19
    |
 LL | struct D<const X: C>;
index 86540db2d03a0a1538de360c3232dc84fbf6dcd8..e7356d485dbffa662f21f30259e03e1846598a11 100644 (file)
@@ -8,11 +8,11 @@
 struct A;
 
 struct B<const X: A>; // ok
-//[min]~^ ERROR using `A` as const generic parameters is forbidden
+//[min]~^ ERROR `A` is forbidden
 
 struct C;
 
 struct D<const X: C>; //~ ERROR `C` must be annotated with `#[derive(PartialEq, Eq)]`
-//[min]~^ ERROR using `C` as const generic parameters is forbidden
+//[min]~^ ERROR `C` is forbidden
 
 fn main() {}
index 3ff17ddb3bcf3bd820848ed7cf9d360a580b5c1f..786ded3c2fe42aabc4b2201d3fcb021fd410db84 100644 (file)
@@ -1,4 +1,4 @@
-error: using `&'static str` as const generic parameters is forbidden
+error: `&'static str` is forbidden as the type of a const generic parameter
   --> $DIR/issue-66596-impl-trait-for-str-const-arg.rs:9:25
    |
 LL | trait Trait<const NAME: &'static str> {
index d458a366fb3737fcf80c43ab88766324cc1b2db6..11d4bf4c3e6aa87f58b688f0f6a20d69457fcade 100644 (file)
@@ -7,7 +7,7 @@
 
 
 trait Trait<const NAME: &'static str> {
-//[min]~^ ERROR using `&'static str` as const generic parameters is forbidden
+//[min]~^ ERROR `&'static str` is forbidden
     type Assoc;
 }
 
index e98f1d94a72409efb1d4be445de6e8af6177101d..f093e6651bc2826bd14c7536ea3264f3a32e31c4 100644 (file)
@@ -1,4 +1,4 @@
-error: using `Inner` as const generic parameters is forbidden
+error: `Inner` is forbidden as the type of a const generic parameter
   --> $DIR/issue-74950.rs:18:23
    |
 LL | struct Outer<const I: Inner>;
@@ -7,7 +7,7 @@ LL | struct Outer<const I: Inner>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `Inner` as const generic parameters is forbidden
+error: `Inner` is forbidden as the type of a const generic parameter
   --> $DIR/issue-74950.rs:18:23
    |
 LL | struct Outer<const I: Inner>;
@@ -16,7 +16,7 @@ LL | struct Outer<const I: Inner>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `Inner` as const generic parameters is forbidden
+error: `Inner` is forbidden as the type of a const generic parameter
   --> $DIR/issue-74950.rs:18:23
    |
 LL | struct Outer<const I: Inner>;
@@ -25,7 +25,7 @@ LL | struct Outer<const I: Inner>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `Inner` as const generic parameters is forbidden
+error: `Inner` is forbidden as the type of a const generic parameter
   --> $DIR/issue-74950.rs:18:23
    |
 LL | struct Outer<const I: Inner>;
@@ -34,7 +34,7 @@ LL | struct Outer<const I: Inner>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `Inner` as const generic parameters is forbidden
+error: `Inner` is forbidden as the type of a const generic parameter
   --> $DIR/issue-74950.rs:18:23
    |
 LL | struct Outer<const I: Inner>;
index bfa0630a9362991259bfee784a01b27cd623ef74..39f91f2b83dfbe7a08687457e57a5abf124c57ca 100644 (file)
 // - impl StructuralEq
 #[derive(PartialEq, Eq)]
 struct Outer<const I: Inner>;
-//[min]~^ using `Inner` as const generic parameters is forbidden
-//[min]~| using `Inner` as const generic parameters is forbidden
-//[min]~| using `Inner` as const generic parameters is forbidden
-//[min]~| using `Inner` as const generic parameters is forbidden
-//[min]~| using `Inner` as const generic parameters is forbidden
+//[min]~^ `Inner` is forbidden
+//[min]~| `Inner` is forbidden
+//[min]~| `Inner` is forbidden
+//[min]~| `Inner` is forbidden
+//[min]~| `Inner` is forbidden
 
 fn main() {}
index a396fa83aa629c014070723fb3ae32c37bca3815..98bc99d019421f3c6f69344d3df62502678d3999 100644 (file)
@@ -1,18 +1,17 @@
 #![feature(min_const_generics)]
 
 struct Foo<const N: [u8; 0]>;
-//~^ ERROR using `[u8; 0]` as const generic parameters is forbidden
+//~^ ERROR `[u8; 0]` is forbidden
 
 struct Bar<const N: ()>;
-//~^ ERROR using `()` as const generic parameters is forbidden
-
+//~^ ERROR `()` is forbidden
 #[derive(PartialEq, Eq)]
 struct No;
 
 struct Fez<const N: No>;
-//~^ ERROR using `No` as const generic parameters is forbidden
+//~^ ERROR `No` is forbidden
 
 struct Faz<const N: &'static u8>;
-//~^ ERROR using `&'static u8` as const generic parameters is forbidden
+//~^ ERROR `&'static u8` is forbidden
 
 fn main() {}
index 835b1f1a3e8675aba34724349605ed824d3b8f4c..4772aaf1b3e0c252c2fdec741953387892dc79b5 100644 (file)
@@ -1,4 +1,4 @@
-error: using `[u8; 0]` as const generic parameters is forbidden
+error: `[u8; 0]` is forbidden as the type of a const generic parameter
   --> $DIR/complex-types.rs:3:21
    |
 LL | struct Foo<const N: [u8; 0]>;
@@ -7,7 +7,7 @@ LL | struct Foo<const N: [u8; 0]>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `()` as const generic parameters is forbidden
+error: `()` is forbidden as the type of a const generic parameter
   --> $DIR/complex-types.rs:6:21
    |
 LL | struct Bar<const N: ()>;
@@ -16,8 +16,8 @@ LL | struct Bar<const N: ()>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `No` as const generic parameters is forbidden
-  --> $DIR/complex-types.rs:12:21
+error: `No` is forbidden as the type of a const generic parameter
+  --> $DIR/complex-types.rs:11:21
    |
 LL | struct Fez<const N: No>;
    |                     ^^
@@ -25,8 +25,8 @@ LL | struct Fez<const N: No>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static u8` as const generic parameters is forbidden
-  --> $DIR/complex-types.rs:15:21
+error: `&'static u8` is forbidden as the type of a const generic parameter
+  --> $DIR/complex-types.rs:14:21
    |
 LL | struct Faz<const N: &'static u8>;
    |                     ^^^^^^^^^^^
index a55d43d395c842513f6118a6906d1f9eb5115242..ded6f882caf42f139cd5a2850645ca3ec5c66b88 100644 (file)
@@ -1,11 +1,11 @@
 error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/nested-type.rs:17:5
+  --> $DIR/nested-type.rs:16:5
    |
 LL |     Foo::<17>::value()
    |     ^^^^^^^^^^^^^^^^^^
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/nested-type.rs:17:5
+  --> $DIR/nested-type.rs:16:5
    |
 LL |     Foo::<17>::value()
    |     ^^^^^^^^^^^^^^^^^^ calling non-const function `Foo::{{constant}}#0::Foo::<17_usize>::value`
index 17e2eef7278a0cdca70b815eb1dbe04dae2d6f53..55f6fe7cc16e85eab2dc01521212e4a21576fdbd 100644 (file)
@@ -1,11 +1,11 @@
-error: using `[u8; _]` as const generic parameters is forbidden
+error: `[u8; _]` is forbidden as the type of a const generic parameter
   --> $DIR/nested-type.rs:7:21
    |
 LL |   struct Foo<const N: [u8; {
    |  _____________________^
-LL | |
 LL | |     struct Foo<const N: usize>;
 LL | |
+LL | |     impl<const N: usize> Foo<N> {
 ...  |
 LL | |
 LL | | }]>;
@@ -15,13 +15,13 @@ LL | | }]>;
    = note: more complex types are supported with `#[feature(const_generics)]`
 
 error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
-  --> $DIR/nested-type.rs:17:5
+  --> $DIR/nested-type.rs:16:5
    |
 LL |     Foo::<17>::value()
    |     ^^^^^^^^^^^^^^^^^^
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/nested-type.rs:17:5
+  --> $DIR/nested-type.rs:16:5
    |
 LL |     Foo::<17>::value()
    |     ^^^^^^^^^^^^^^^^^^ calling non-const function `Foo::{{constant}}#0::Foo::<17_usize>::value`
index 70d6ac42e9ff2b153c6aeab34d479ccf170c15ba..8372551fb450b5293254031f60a3a0b0d26b840c 100644 (file)
@@ -4,8 +4,7 @@
 #![cfg_attr(full, allow(incomplete_features))]
 #![cfg_attr(min, feature(min_const_generics))]
 
-struct Foo<const N: [u8; {
-//[min]~^ ERROR using `[u8; _]` as const generic
+struct Foo<const N: [u8; { //[min]~ ERROR `[u8; _]` is forbidden
     struct Foo<const N: usize>;
 
     impl<const N: usize> Foo<N> {
index dc4bb8b0f042a3870d7b79429c9b81d29b688698..ffaab51f766d8d8b264c03f9096935041fc9a7cc 100644 (file)
@@ -3,18 +3,12 @@ error: using raw pointers as const generic parameters is forbidden
    |
 LL | struct Const<const P: *const u32>;
    |                       ^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: using raw pointers as const generic parameters is forbidden
   --> $DIR/raw-ptr-const-param-deref.rs:12:15
    |
 LL | impl<const P: *const u32> Const<P> {
    |               ^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: aborting due to 2 previous errors
 
index f387974a21aca244c54cea61cb9731069401782e..d317aa0f585cf9c616ae74b02b5f952ee24a5faa 100644 (file)
@@ -3,9 +3,6 @@ error: using raw pointers as const generic parameters is forbidden
    |
 LL | struct Const<const P: *const u32>;
    |                       ^^^^^^^^^^
-   |
-   = note: the only supported types are integers, `bool` and `char`
-   = note: more complex types are supported with `#[feature(const_generics)]`
 
 error: aborting due to previous error
 
index e86f885b9bbadab5e5cfeeada2ddfc45368b2fee..1f711bef4aa633bed823f9ec73383956e8d4ce6a 100644 (file)
@@ -1,4 +1,4 @@
-error: using `&'static str` as const generic parameters is forbidden
+error: `&'static str` is forbidden as the type of a const generic parameter
   --> $DIR/slice-const-param-mismatch.rs:8:29
    |
 LL | struct ConstString<const T: &'static str>;
@@ -7,7 +7,7 @@ LL | struct ConstString<const T: &'static str>;
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static [u8]` as const generic parameters is forbidden
+error: `&'static [u8]` is forbidden as the type of a const generic parameter
   --> $DIR/slice-const-param-mismatch.rs:10:28
    |
 LL | struct ConstBytes<const T: &'static [u8]>;
index e2ffc67c3579cd10f736d1a94caa06e57b54eb93..2a49619e6614ae308b4f554b9dab88001f6299c1 100644 (file)
@@ -1,4 +1,4 @@
-error: using `&'static str` as const generic parameters is forbidden
+error: `&'static str` is forbidden as the type of a const generic parameter
   --> $DIR/slice-const-param.rs:8:40
    |
 LL | pub fn function_with_str<const STRING: &'static str>() -> &'static str {
@@ -7,7 +7,7 @@ LL | pub fn function_with_str<const STRING: &'static str>() -> &'static str {
    = note: the only supported types are integers, `bool` and `char`
    = note: more complex types are supported with `#[feature(const_generics)]`
 
-error: using `&'static [u8]` as const generic parameters is forbidden
+error: `&'static [u8]` is forbidden as the type of a const generic parameter
   --> $DIR/slice-const-param.rs:13:41
    |
 LL | pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
index 1b6d2f6216c44d27afdfa498eade3cea06c5bb43..f76e948c4af2b81ef0fce0735719e073ff6d8ccd 100644 (file)
@@ -6,12 +6,12 @@
 #![cfg_attr(min, feature(min_const_generics))]
 
 pub fn function_with_str<const STRING: &'static str>() -> &'static str {
-    //[min]~^ ERROR using `&'static str` as const
+    //[min]~^ ERROR `&'static str` is forbidden
     STRING
 }
 
 pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
-    //[min]~^ ERROR using `&'static [u8]` as const
+    //[min]~^ ERROR `&'static [u8]` is forbidden
     BYTES
 }