]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/defaults/const-default.rs
Rollup merge of #107486 - compiler-errors:bound-ty-keep-name, r=oli-obk
[rust.git] / tests / ui / const-generics / defaults / const-default.rs
1 // run-pass
2 pub struct ConstDefault<const N: usize = 3>;
3
4 impl<const N: usize> ConstDefault<N> {
5     fn foo(self) -> usize {
6         N
7     }
8 }
9
10 impl ConstDefault {
11     fn new() -> Self {
12         ConstDefault
13     }
14
15     fn bar(self) {}
16 }
17
18 pub fn main() {
19     let s = ConstDefault::new();
20     assert_eq!(s.foo(), 3);
21
22     let w = ConstDefault::<3>;
23     w.bar();
24 }