]> git.proxmox.com Git - rustc.git/blob - src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / rfc-2632-const-trait-impl / const-default-method-bodies.rs
1 #![feature(const_trait_impl)]
2
3 #[const_trait]
4 trait ConstDefaultFn: Sized {
5 fn b(self);
6
7 fn a(self) {
8 self.b();
9 }
10 }
11
12 struct NonConstImpl;
13 struct ConstImpl;
14
15 impl ConstDefaultFn for NonConstImpl {
16 fn b(self) {}
17 }
18
19 impl const ConstDefaultFn for ConstImpl {
20 fn b(self) {}
21 }
22
23 const fn test() {
24 NonConstImpl.a();
25 //~^ ERROR the trait bound
26 //~| ERROR cannot call non-const fn
27 ConstImpl.a();
28 }
29
30 fn main() {}