2024-02-16 14:02:50 -06:00
|
|
|
//@ check-pass
|
2022-05-09 09:14:43 -05:00
|
|
|
|
2020-10-01 19:39:04 -05:00
|
|
|
trait Usizer {
|
|
|
|
fn m(self) -> usize;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f<const N: usize>(u: impl Usizer) -> usize {
|
|
|
|
N + u.m()
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Usizable;
|
|
|
|
|
|
|
|
impl Usizer for Usizable {
|
|
|
|
fn m(self) -> usize {
|
|
|
|
16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(f::<4usize>(Usizable), 20usize);
|
|
|
|
}
|