]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / const-generics / generic_const_exprs / object-safety-ok-infer-err.rs
1 #![feature(generic_const_exprs)]
2 #![allow(incomplete_features)]
3
4 trait Foo<const N: usize> {
5 fn test(&self) -> [u8; N + 1];
6 }
7
8 impl<const N: usize> Foo<N> for () {
9 fn test(&self) -> [u8; N + 1] {
10 [0; N + 1]
11 }
12 }
13
14 fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
15 assert_eq!(v.test(), [0; N + 1]);
16 }
17
18 fn main() {
19 use_dyn(&());
20 //~^ ERROR type annotations needed
21 }