Auto merge of #80714 - jakevossen5:master, r=lcnr

fixed const_generics error help

Closes https://github.com/rust-lang/rust/issues/80702
This commit is contained in:
bors 2021-01-06 10:25:18 +00:00
commit 8fec6c7bb9
29 changed files with 55 additions and 55 deletions

View File

@ -330,7 +330,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
),
)
.note("the only supported types are integers, `bool` and `char`")
.help("more complex types are supported with `#[feature(const_generics)]`")
.help("more complex types are supported with `#![feature(const_generics)]`")
.emit()
}
};

View File

@ -23,7 +23,7 @@ LL | struct B<const CFG: Config> {
| ^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 3 previous errors

View File

@ -17,7 +17,7 @@ LL | fn bar<const X: (), 'a>(_: &'a ()) {
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/const-param-before-other-params.rs:10:17
@ -26,7 +26,7 @@ LL | fn foo<const X: (), T>(_: &T) {}
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 4 previous errors

View File

@ -35,7 +35,7 @@ LL | struct A<const N: &u8>;
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:15:15
@ -44,7 +44,7 @@ LL | impl<const N: &u8> A<N> {
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:23:15
@ -53,7 +53,7 @@ LL | impl<const N: &u8> B for A<N> {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:27:17
@ -62,7 +62,7 @@ LL | fn bar<const N: &u8>() {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:18:21
@ -71,7 +71,7 @@ LL | fn foo<const M: &u8>(&self) {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 10 previous errors

View File

@ -17,7 +17,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `[u8; _]` is forbidden as the type of a const generic parameter
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
@ -26,7 +26,7 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 4 previous errors

View File

@ -5,7 +5,7 @@ LL | struct Const<const V: [usize; 1]> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | struct B<const X: A>; // ok
| ^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `C` is forbidden as the type of a const generic parameter
--> $DIR/forbid-non-structural_match-types.rs:14:19
@ -14,7 +14,7 @@ LL | struct D<const X: C>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/forbid-non-structural_match-types.rs:14:19

View File

@ -14,7 +14,7 @@ LL | trait Trait<const S: &'static str> {}
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | trait Trait<const NAME: &'static str> {
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | fn foo<const T: NoMatch>() -> bool {
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -11,7 +11,7 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/issue-63322-forbid-dyn.rs:9:18

View File

@ -5,7 +5,7 @@ LL | struct Const<const V: [usize; 0]> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | struct Foo<const V: [usize; 0] > {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -11,7 +11,7 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn hoge<const IN: [u32; LEN]>() {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | fn test<const N: [u8; 1 + 2]>() {}
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `[u8; _]` is forbidden as the type of a const generic parameter
--> $DIR/issue-74101.rs:9:21
@ -14,7 +14,7 @@ LL | struct Foo<const N: [u8; 1 + 2]>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn ice_struct_fn<const I: IceEnum>() {}
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:17:23
@ -14,7 +14,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:17:23
@ -23,7 +23,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:17:23
@ -32,7 +32,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `Inner` is forbidden as the type of a const generic parameter
--> $DIR/issue-74950.rs:17:23
@ -41,7 +41,7 @@ LL | struct Outer<const I: Inner>;
| ^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 5 previous errors

View File

@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; Bar::<u32>::value()]>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | struct Foo<const N: [u8; 0]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:6:21
@ -14,7 +14,7 @@ LL | struct Bar<const N: ()>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `No` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:11:21
@ -23,7 +23,7 @@ LL | struct Fez<const N: No>;
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:14:21
@ -32,7 +32,7 @@ LL | struct Faz<const N: &'static u8>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `!` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:17:21
@ -41,7 +41,7 @@ LL | struct Fiz<const N: !>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:20:19
@ -50,7 +50,7 @@ LL | enum Goo<const N: ()> { A, B }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `()` is forbidden as the type of a const generic parameter
--> $DIR/complex-types.rs:23:20
@ -59,7 +59,7 @@ LL | union Boo<const N: ()> { a: () }
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 7 previous errors

View File

@ -5,7 +5,7 @@ LL | fn a<const X: &'static [u32]>() {}
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -5,7 +5,7 @@ LL | struct Const<const P: &'static ()>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error

View File

@ -12,7 +12,7 @@ LL | | }]>;
| |__^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: 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:15:5

View File

@ -5,7 +5,7 @@ LL | struct ConstString<const T: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static [u8]` is forbidden as the type of a const generic parameter
--> $DIR/slice-const-param-mismatch.rs:9:28
@ -14,7 +14,7 @@ LL | struct ConstBytes<const T: &'static [u8]>;
| ^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | pub fn function_with_str<const STRING: &'static str>() -> &'static str {
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static [u8]` is forbidden as the type of a const generic parameter
--> $DIR/slice-const-param.rs:12:41
@ -14,7 +14,7 @@ LL | pub fn function_with_bytes<const BYTES: &'static [u8]>() -> &'static [u8] {
| ^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | struct _Range<const R: std::ops::Range<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `RangeFrom<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:12:28
@ -14,7 +14,7 @@ LL | struct _RangeFrom<const R: std::ops::RangeFrom<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `RangeFull` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:17:28
@ -23,7 +23,7 @@ LL | struct _RangeFull<const R: std::ops::RangeFull>;
| ^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `RangeInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:23:33
@ -32,7 +32,7 @@ LL | struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `RangeTo<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:28:26
@ -41,7 +41,7 @@ LL | struct _RangeTo<const R: std::ops::RangeTo<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `RangeToInclusive<usize>` is forbidden as the type of a const generic parameter
--> $DIR/const-generics-range.rs:33:35
@ -50,7 +50,7 @@ LL | struct _RangeToInclusive<const R: std::ops::RangeToInclusive<usize>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 6 previous errors

View File

@ -5,7 +5,7 @@ LL | trait Get<'a, const N: &'static str> {
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/issue-71348.rs:18:25
@ -14,7 +14,7 @@ LL | fn ask<'a, const N: &'static str>(&'a self) -> &'a <Self as Get<N>>::Ta
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn foo<const X: ()>() {}
| ^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#[feature(const_generics)]`
= help: more complex types are supported with `#![feature(const_generics)]`
error: aborting due to previous error