1 // run-pass 2 pub struct ConstDefault<const N: usize = 3>; 3 4 impl<const N: usize> ConstDefault<N> { foo(self) -> usize5 fn foo(self) -> usize { 6 N 7 } 8 } 9 10 impl ConstDefault { new() -> Self11 fn new() -> Self { 12 ConstDefault 13 } 14 bar(self)15 fn bar(self) {} 16 } 17 main()18pub fn main() { 19 let s = ConstDefault::new(); 20 assert_eq!(s.foo(), 3); 21 22 let w = ConstDefault::<3>; 23 w.bar(); 24 } 25