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 @@ pub fn enabled(&self, feature: Symbol) -> bool {
}
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 @@ pub fn set(&self, features: &mut Features, span: Span) {
(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 @@ macro_rules! 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 @@
add_assign,
add_with_overflow,
address,
adt_const_params,
advanced_slice_patterns,
adx_target_feature,
alias,
@ -451,7 +452,6 @@
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()

View file

@ -82,7 +82,7 @@
#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
#![feature(const_param_types, generators, generator_trait)]
#![feature(adt_const_params, generators, generator_trait)]
#![allow(incomplete_features)]
use Mod1::TestTrait2;

View file

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(generic_const_exprs, const_param_types)]
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
// regression test for #77650
fn c<T, const N: std::num::NonZeroUsize>()

View file

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(generic_const_exprs, const_param_types, const_generics_defaults)]
#![feature(generic_const_exprs, adt_const_params, const_generics_defaults)]
#![allow(incomplete_features)]
// regression test for #77650
struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])

View file

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(generic_const_exprs, const_param_types)]
#![feature(generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
use std::{convert::TryFrom, num::NonZeroUsize};

View file

@ -1,4 +1,4 @@
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![crate_name = "foo"]

View file

@ -1,7 +1,7 @@
// edition:2018
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Foo;

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:14: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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:17:21
@ -53,7 +53,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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:22:15
@ -62,7 +62,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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: `&'static u8` is forbidden as the type of a const generic parameter
--> $DIR/const-param-elided-lifetime.rs:26:17
@ -71,7 +71,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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 10 previous errors

View file

@ -3,7 +3,7 @@
// elided lifetimes within the type of a const generic parameters to be 'static, like elided
// lifetimes within const/static items.
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct A<const N: &u8>;

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 4 previous errors

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
// Currently, const parameters cannot depend on other generic parameters,

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
// Currently, const parameters cannot depend on other generic parameters,

View file

@ -2,7 +2,7 @@
// run-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct A<const N: u8>;

View file

@ -1,5 +1,5 @@
// Check that different const types are different.
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]
struct Const<const V: [usize; 1]> {}

View file

@ -1,7 +1,7 @@
// Check that functions cannot be used as const parameters.
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
fn function() -> u32 {

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Checked<const F: fn(usize) -> bool>;

View file

@ -1,4 +1,4 @@
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]
#[derive(PartialEq, Eq)]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 3 previous errors

View file

@ -1,7 +1,7 @@
// Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`.
// revisions: full min
#![cfg_attr(full, feature(generic_const_exprs, const_param_types))]
#![cfg_attr(full, feature(generic_const_exprs, adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
#[allow(dead_code)]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -2,7 +2,7 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_param_types, generic_const_exprs))]
#![cfg_attr(full, feature(adt_const_params, generic_const_exprs))]
#![feature(core_intrinsics)]
#![feature(const_type_name)]

View file

@ -1,4 +1,4 @@
#![feature(const_param_types, const_generics_defaults)]
#![feature(adt_const_params, const_generics_defaults)]
#![allow(incomplete_features)]
#[derive(PartialEq, Eq)]

View file

@ -1,6 +1,6 @@
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-518402995.
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
#![crate_type = "lib"]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types, generic_arg_infer))]
#![cfg_attr(full, feature(adt_const_params, generic_arg_infer))]
#![cfg_attr(full, allow(incomplete_features))]
fn foo<const N: usize, const A: [u8; N]>() {}

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
trait A {}

View file

@ -1,5 +1,5 @@
// check-pass
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Const<const V: [usize; 0]> {}

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Foo<const V: [usize; 0] > {}

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Test(*const usize);

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Test();

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
fn func<A, const F: fn(inner: A)>(outer: A) {

View file

@ -1,5 +1,5 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
use std::ffi::{CStr, CString};

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
const LEN: usize = 1024;

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
fn test<const N: [u8; 1 + 2]>() {}

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
#[derive(PartialEq, Eq)]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 5 previous errors

View file

@ -1,6 +1,6 @@
// [full] build-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Bar<T>(T);

View file

@ -1,6 +1,6 @@
// ignore-test
// FIXME(const_generics): This test causes an ICE after reverting #76030.
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]
@ -9,7 +9,7 @@
fn main() {
let b: Bug::<{
unsafe {
// FIXME(const_param_types): Decide on how to deal with invalid values as const params.
// FIXME(adt_const_params): Decide on how to deal with invalid values as const params.
std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5])
}
}>;

View file

@ -1,6 +1,6 @@
// build-pass
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]
#[derive(PartialEq, Eq)]

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/nested-type.rs:15:5

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Foo<const N: [u8; { //[min]~ ERROR `[u8; _]` is forbidden

View file

@ -1,7 +1,7 @@
// Checks that pointers must not be used as the type of const params.
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
const A: u32 = 3;

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Const<const P: *const u32>; //~ ERROR: using raw pointers as const generic parameters

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]

View file

@ -1,6 +1,6 @@
// run-pass
#![feature(const_param_types)]
#![feature(adt_const_params)]
#![allow(incomplete_features)]
pub fn function_with_str<const STRING: &'static str>() -> &'static str {

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 6 previous errors

View file

@ -1,6 +1,6 @@
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
// `Range` should be usable within const generics:

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,7 +1,7 @@
// revisions: full min
//[full] check-pass
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Const<const P: &'static ()>;

View file

@ -1,7 +1,7 @@
// run-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
use std::mem::MaybeUninit;

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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
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_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to 2 previous errors

View file

@ -1,6 +1,6 @@
// [full] run-pass
// revisions: full min
#![cfg_attr(full, feature(const_param_types))]
#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]
struct Foo {

View file

@ -1,5 +1,5 @@
#![feature(const_param_types)]
//~^ WARN the feature `const_param_types` is incomplete
#![feature(adt_const_params)]
//~^ WARN the feature `adt_const_params` is incomplete
fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0771

View file

@ -1,8 +1,8 @@
warning: the feature `const_param_types` is incomplete and may not be safe to use and/or cause compiler crashes
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/E0771.rs:1:12
|
LL | #![feature(const_param_types)]
| ^^^^^^^^^^^^^^^^^
LL | #![feature(adt_const_params)]
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

View file

@ -1,11 +1,11 @@
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/feature-gate-const_param_types.rs:1:24
--> $DIR/feature-gate-adt_const_params.rs:1:24
|
LL | struct Foo<const NAME: &'static str>;
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= help: more complex types are supported with `#![feature(const_param_types)]`
= help: more complex types are supported with `#![feature(adt_const_params)]`
error: aborting due to previous error

View file

@ -1,6 +1,6 @@
// build-fail
// compile-flags: -Z symbol-mangling-version=v0 --crate-name=c
#![feature(const_param_types, rustc_attrs)]
#![feature(adt_const_params, rustc_attrs)]
#![allow(incomplete_features)]
pub struct Str<const S: &'static str>;

View file

@ -6,7 +6,7 @@
// normalize-stderr-test: "Cs[0-9a-zA-Z]+_4core" -> "Cs$$HASH_4core"
// normalize-stderr-test: "core\[[0-9a-f]+\]" -> "core[$$HASH_HEX]"
#![feature(const_param_types, decl_macro, rustc_attrs)]
#![feature(adt_const_params, decl_macro, rustc_attrs)]
#![allow(incomplete_features)]
pub struct RefByte<const RB: &'static u8>;