]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs
Auto merge of #105651 - tgross35:once-cell-inline, r=m-ou-se
[rust.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     ConstImpl.a();
27 }
28
29 fn main() {}