]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/const_evaluatable_checked/object-safety-err-ret.rs
Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase
[rust.git] / src / test / ui / const-generics / const_evaluatable_checked / object-safety-err-ret.rs
1 #![feature(const_generics, const_evaluatable_checked)]
2 #![allow(incomplete_features)]
3
4
5 const fn bar<T: ?Sized>() -> usize { 7 }
6
7 trait Foo {
8     fn test(&self) -> [u8; bar::<Self>()];
9 }
10
11 impl Foo for () {
12     fn test(&self) -> [u8; bar::<Self>()] {
13         [0; bar::<Self>()]
14     }
15 }
16
17 fn use_dyn(v: &dyn Foo) { //~ERROR the trait `Foo` cannot be made into an object
18     v.test();
19 }
20
21 fn main() {}