]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn.rs
Auto merge of #84589 - In-line:zircon-thread-name, r=JohnTitor
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / impl-with-default-fn.rs
1 #![feature(const_trait_impl)]
2
3 trait Tr {
4     fn req(&self);
5
6     fn prov(&self) {
7         println!("lul");
8         self.req();
9     }
10
11     #[default_method_body_is_const]
12     fn default() {}
13 }
14
15 struct S;
16
17 impl const Tr for S {
18     fn req(&self) {}
19 } //~^^ ERROR const trait implementations may not use non-const default functions
20
21 impl const Tr for u8 {
22     fn req(&self) {}
23     fn prov(&self) {}
24 }
25
26 impl const Tr for u16 {
27     fn prov(&self) {}
28     fn default() {}
29 } //~^^^ ERROR not all trait items implemented
30
31
32 impl const Tr for u32 {
33     fn req(&self) {}
34     fn default() {}
35 } //~^^^ ERROR const trait implementations may not use non-const default functions
36
37 fn main() {}