feature(const_param_types)
-> feature(adt_const_params)
This commit is contained in:
parent
4747cbb3bb
commit
87e781799a
77 changed files with 108 additions and 108 deletions
|
@ -3,7 +3,7 @@ A non-structural-match type was used as the type of a const generic parameter.
|
|||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0741
|
||||
#![feature(const_param_types)]
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
struct A;
|
||||
|
||||
|
@ -16,7 +16,7 @@ may be used as the types of const generic parameters.
|
|||
To fix the previous code example, we derive `PartialEq` and `Eq`:
|
||||
|
||||
```
|
||||
#![feature(const_param_types)]
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
#[derive(PartialEq, Eq)] // We derive both traits here.
|
||||
struct A;
|
||||
|
|
|
@ -4,7 +4,7 @@ allowed.
|
|||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0771
|
||||
#![feature(const_param_types)]
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
fn function_with_str<'a, const STRING: &'a str>() {} // error!
|
||||
```
|
||||
|
@ -13,7 +13,7 @@ To fix this issue, the lifetime in the const generic need to be changed to
|
|||
`'static`:
|
||||
|
||||
```
|
||||
#![feature(const_param_types)]
|
||||
#![feature(adt_const_params)]
|
||||
|
||||
fn function_with_str<const STRING: &'static str>() {} // ok!
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue