Add missing tests in root const-gen dir

This commit is contained in:
kadmin
2020-08-09 06:19:57 +00:00
parent be650a7ecd
commit 9bf40f10bc
83 changed files with 1182 additions and 102 deletions

View File

@@ -1,9 +1,14 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// Tests that array sizes that depend on const-params does not yet work.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[allow(dead_code)]
struct ArithArrayLen<const N: usize>([u32; 0 + N]);
//~^ ERROR constant expression depends on a generic parameter
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
#[derive(PartialEq, Eq)]
struct Config {
@@ -11,7 +16,10 @@ struct Config {
}
struct B<const CFG: Config> {
arr: [u8; CFG.arr_size], //~ ERROR constant expression depends on a generic parameter
//[min]~^ ERROR using `Config` as const generic parameters is forbidden
arr: [u8; CFG.arr_size],
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
}
const C: Config = Config { arr_size: 5 };