rust/tests/ui/const-generics/issues/issue-83249.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
322 B
Rust
Raw Normal View History

2021-10-18 11:25:45 -05:00
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
trait Foo {
const N: usize;
}
impl Foo for u8 {
const N: usize = 1;
}
fn foo<T: Foo>(_: [u8; T::N]) -> T {
todo!()
}
pub fn bar() {
let _: u8 = foo([0; 1]);
let _ = foo([0; 1]);
//~^ ERROR type annotations needed
}
fn main() {}