]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/const_evaluatable_checked/object-safety-ok-infer-err.rs
Rollup merge of #79399 - pickfire:patch-3, r=JohnTitor
[rust.git] / src / test / ui / const-generics / const_evaluatable_checked / object-safety-ok-infer-err.rs
1 #![feature(const_generics, const_evaluatable_checked)]
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     // FIXME(const_evaluatable_checked): Improve the error message here.
20     use_dyn(&());
21     //~^ ERROR type annotations needed
22 }