// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
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);
}
results in:
error[E0282]: type annotations needed
--> bug.rs:23:16
|
23 | assert_eq!(f::<4usize>(Usizable), 20usize);
| ^^^^^^^^^^^ cannot infer type for `fn(Usizable) -> usize {f::<Usizable, _: usize>}`
results in: