rust/tests/ui/const-generics/defaults/default-const-param-cannot-reference-self.rs

15 lines
445 B
Rust
Raw Normal View History

2021-07-14 13:22:32 -05:00
struct Struct<const N: usize = { Self; 10 }>;
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
enum Enum<const N: usize = { Self; 10 }> { }
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
union Union<const N: usize = { Self; 10 }> { not_empty: () }
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
fn main() {
let _: Struct;
let _: Enum;
let _: Union;
}