rust/src/test/ui/const-generics/defaults/complex-generic-default-expr.rs

18 lines
711 B
Rust
Raw Normal View History

// revisions: min
// FIXME(const_generics): add the `full` revision,
// currently causes an ICE as we don't supply substs to
// anon consts in the parameter listing, as that would
// cause that anon const to reference itself.
#![cfg_attr(full, feature(const_generics))]
#![feature(const_generics_defaults)]
2021-04-18 11:57:22 +00:00
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;
//[min]~^ ERROR generic parameters may not be used in const operations
2021-04-18 11:57:22 +00:00
struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T);
//[min]~^ ERROR generic parameters may not be used in const operations
//[full]~^^ ERROR the size for values of type `T` cannot be known at compilation time
2021-04-18 11:57:22 +00:00
fn main() {}