Skip to content

Commit f37e737

Browse files
committed
fixed const_generics error help
1 parent f412fb5 commit f37e737

28 files changed

+54
-54
lines changed

compiler/rustc_typeck/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
330330
),
331331
)
332332
.note("the only supported types are integers, `bool` and `char`")
333-
.help("more complex types are supported with `#[feature(const_generics)]`")
333+
.help("more complex types are supported with `#![feature(const_generics)]`")
334334
.emit()
335335
}
336336
};

src/test/ui/const-generics/array-size-in-generic-struct-param.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ LL | struct B<const CFG: Config> {
2323
| ^^^^^^
2424
|
2525
= note: the only supported types are integers, `bool` and `char`
26-
= help: more complex types are supported with `#[feature(const_generics)]`
26+
= help: more complex types are supported with `#![feature(const_generics)]`
2727

2828
error: aborting due to 3 previous errors
2929

src/test/ui/const-generics/const-param-before-other-params.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | fn bar<const X: (), 'a>(_: &'a ()) {
1717
| ^^
1818
|
1919
= note: the only supported types are integers, `bool` and `char`
20-
= help: more complex types are supported with `#[feature(const_generics)]`
20+
= help: more complex types are supported with `#![feature(const_generics)]`
2121

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

3131
error: aborting due to 4 previous errors
3232

src/test/ui/const-generics/const-param-elided-lifetime.min.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ LL | struct A<const N: &u8>;
3535
| ^^^
3636
|
3737
= note: the only supported types are integers, `bool` and `char`
38-
= help: more complex types are supported with `#[feature(const_generics)]`
38+
= help: more complex types are supported with `#![feature(const_generics)]`
3939

4040
error: `&'static u8` is forbidden as the type of a const generic parameter
4141
--> $DIR/const-param-elided-lifetime.rs:15:15
@@ -44,7 +44,7 @@ LL | impl<const N: &u8> A<N> {
4444
| ^^^
4545
|
4646
= note: the only supported types are integers, `bool` and `char`
47-
= help: more complex types are supported with `#[feature(const_generics)]`
47+
= help: more complex types are supported with `#![feature(const_generics)]`
4848

4949
error: `&'static u8` is forbidden as the type of a const generic parameter
5050
--> $DIR/const-param-elided-lifetime.rs:23:15
@@ -53,7 +53,7 @@ LL | impl<const N: &u8> B for A<N> {}
5353
| ^^^
5454
|
5555
= note: the only supported types are integers, `bool` and `char`
56-
= help: more complex types are supported with `#[feature(const_generics)]`
56+
= help: more complex types are supported with `#![feature(const_generics)]`
5757

5858
error: `&'static u8` is forbidden as the type of a const generic parameter
5959
--> $DIR/const-param-elided-lifetime.rs:27:17
@@ -62,7 +62,7 @@ LL | fn bar<const N: &u8>() {}
6262
| ^^^
6363
|
6464
= note: the only supported types are integers, `bool` and `char`
65-
= help: more complex types are supported with `#[feature(const_generics)]`
65+
= help: more complex types are supported with `#![feature(const_generics)]`
6666

6767
error: `&'static u8` is forbidden as the type of a const generic parameter
6868
--> $DIR/const-param-elided-lifetime.rs:18:21
@@ -71,7 +71,7 @@ LL | fn foo<const M: &u8>(&self) {}
7171
| ^^^
7272
|
7373
= note: the only supported types are integers, `bool` and `char`
74-
= help: more complex types are supported with `#[feature(const_generics)]`
74+
= help: more complex types are supported with `#![feature(const_generics)]`
7575

7676
error: aborting due to 10 previous errors
7777

src/test/ui/const-generics/const-param-type-depends-on-const-param.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
1717
| ^^^^^^^
1818
|
1919
= note: the only supported types are integers, `bool` and `char`
20-
= help: more complex types are supported with `#[feature(const_generics)]`
20+
= help: more complex types are supported with `#![feature(const_generics)]`
2121

2222
error: `[u8; _]` is forbidden as the type of a const generic parameter
2323
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
@@ -26,7 +26,7 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
2626
| ^^^^^^^
2727
|
2828
= note: the only supported types are integers, `bool` and `char`
29-
= help: more complex types are supported with `#[feature(const_generics)]`
29+
= help: more complex types are supported with `#![feature(const_generics)]`
3030

3131
error: aborting due to 4 previous errors
3232

src/test/ui/const-generics/different_byref.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct Const<const V: [usize; 1]> {}
55
| ^^^^^^^^^^
66
|
77
= note: the only supported types are integers, `bool` and `char`
8-
= help: more complex types are supported with `#[feature(const_generics)]`
8+
= help: more complex types are supported with `#![feature(const_generics)]`
99

1010
error: aborting due to previous error
1111

src/test/ui/const-generics/forbid-non-structural_match-types.min.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | struct B<const X: A>; // ok
55
| ^
66
|
77
= note: the only supported types are integers, `bool` and `char`
8-
= help: more complex types are supported with `#[feature(const_generics)]`
8+
= help: more complex types are supported with `#![feature(const_generics)]`
99

1010
error: `C` is forbidden as the type of a const generic parameter
1111
--> $DIR/forbid-non-structural_match-types.rs:14:19
@@ -14,7 +14,7 @@ LL | struct D<const X: C>;
1414
| ^
1515
|
1616
= note: the only supported types are integers, `bool` and `char`
17-
= help: more complex types are supported with `#[feature(const_generics)]`
17+
= help: more complex types are supported with `#![feature(const_generics)]`
1818

1919
error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
2020
--> $DIR/forbid-non-structural_match-types.rs:14:19

src/test/ui/const-generics/intrinsics-type_name-as-const-argument.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | trait Trait<const S: &'static str> {}
1414
| ^^^^^^^^^^^^
1515
|
1616
= note: the only supported types are integers, `bool` and `char`
17-
= help: more complex types are supported with `#[feature(const_generics)]`
17+
= help: more complex types are supported with `#![feature(const_generics)]`
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/const-generics/issue-66596-impl-trait-for-str-const-arg.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | trait Trait<const NAME: &'static str> {
55
| ^^^^^^^^^^^^
66
|
77
= note: the only supported types are integers, `bool` and `char`
8-
= help: more complex types are supported with `#[feature(const_generics)]`
8+
= help: more complex types are supported with `#![feature(const_generics)]`
99

1010
error: aborting due to previous error
1111

src/test/ui/const-generics/issues/issue-62579-no-match.min.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | fn foo<const T: NoMatch>() -> bool {
55
| ^^^^^^^
66
|
77
= note: the only supported types are integers, `bool` and `char`
8-
= help: more complex types are supported with `#[feature(const_generics)]`
8+
= help: more complex types are supported with `#![feature(const_generics)]`
99

1010
error: aborting due to previous error
1111

0 commit comments

Comments
 (0)