Closed
Description
// 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>}`
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(const_generics)]`Relevant to the compiler team, which will review and decide on the PR/issue.An error is correctly emitted, but is confusing, for `min_const_generics`.This issue requires a nightly compiler in some way.