1
Fork 0

feature(const_param_types) -> feature(adt_const_params)

This commit is contained in:
lcnr 2021-08-30 10:59:53 +02:00
parent 4747cbb3bb
commit 87e781799a
77 changed files with 108 additions and 108 deletions

View file

@ -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;

View file

@ -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!
```

View file

@ -71,7 +71,7 @@ macro_rules! declare_features {
}
pub fn unordered_const_ty_params(&self) -> bool {
self.const_generics_defaults || self.generic_const_exprs || self.const_param_types
self.const_generics_defaults || self.generic_const_exprs || self.adt_const_params
}
/// Some features are known to be incomplete and using them is likely to have
@ -674,7 +674,7 @@ declare_features! (
(incomplete, generic_const_exprs, "1.56.0", Some(76560), None),
/// Allows additional const parameter types, such as `&'static str` or user defined types
(incomplete, const_param_types, "1.56.0", Some(44580), None),
(incomplete, adt_const_params, "1.56.0", Some(44580), None),
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates

View file

@ -104,7 +104,7 @@ declare_features! (
(removed, quote, "1.33.0", Some(29601), None, None),
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
(removed, const_generics, "1.34.0", Some(44580), None,
Some("removed in favor of `#![feature(const_param_types]` and `#![feature(generic_const_exprs)]`")),
Some("removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`")),
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
Some("removed due to causing promotable bugs")),

View file

@ -284,6 +284,7 @@ symbols! {
add_assign,
add_with_overflow,
address,
adt_const_params,
advanced_slice_patterns,
adx_target_feature,
alias,
@ -451,7 +452,6 @@ symbols! {
const_mut_refs,
const_panic,
const_panic_fmt,
const_param_types,
const_precise_live_drops,
const_ptr,
const_raw_ptr_deref,

View file

@ -290,7 +290,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
let err_ty_str;
let mut is_ptr = true;
let err = if tcx.features().const_param_types {
let err = if tcx.features().adt_const_params {
match ty.peel_refs().kind() {
ty::FnPtr(_) => Some("function pointers"),
ty::RawPtr(_) => Some("raw pointers"),
@ -328,7 +328,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
err.note("the only supported types are integers, `bool` and `char`");
if tcx.sess.is_nightly_build() {
err.help(
"more complex types are supported with `#![feature(const_param_types)]`",
"more complex types are supported with `#![feature(adt_const_params)]`",
);
}
err.emit()