rust/src/test/ui/const-generics/issue-61522-array-len-succ.rs

20 lines
599 B
Rust
Raw Normal View History

// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
2020-04-08 18:57:41 -05:00
pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
//[full]~^ ERROR constant expression depends on a generic parameter
2020-10-12 16:27:59 -05:00
//[min]~^^ ERROR generic parameters may not be used
2020-04-08 18:57:41 -05:00
impl<const COUNT: usize> MyArray<COUNT> {
fn inner(&self) -> &[u8; COUNT + 1] {
//[full]~^ ERROR constant expression depends on a generic parameter
2020-10-12 16:27:59 -05:00
//[min]~^^ ERROR generic parameters may not be used
2020-04-08 18:57:41 -05:00
&self.0
}
}
fn main() {}