]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0790.rs
Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead
[rust.git] / src / test / ui / error-codes / E0790.rs
1 mod inner {
2     pub trait MyTrait {
3         const MY_ASSOC_CONST: ();
4
5         fn my_fn();
6     }
7
8     pub struct MyStruct;
9
10     impl MyTrait for MyStruct {
11         const MY_ASSOC_CONST: () = ();
12
13         fn my_fn() {}
14     }
15
16     fn call() {
17         MyTrait::my_fn(); //~ ERROR E0790
18     }
19
20     fn use_const() {
21         let _ = MyTrait::MY_ASSOC_CONST; //~ ERROR E0790
22     }
23 }
24
25 fn call_inner() {
26     inner::MyTrait::my_fn(); //~ ERROR E0790
27 }
28
29 fn use_const_inner() {
30     let _ = inner::MyTrait::MY_ASSOC_CONST; //~ ERROR E0790
31 }
32
33 trait MyTrait2 {
34     fn my_fn();
35 }
36
37 struct Impl1;
38
39 impl MyTrait2 for Impl1 {
40     fn my_fn() {}
41 }
42
43 struct Impl2;
44
45 impl MyTrait2 for Impl2 {
46     fn my_fn() {}
47 }
48
49 fn call_multiple_impls() {
50     MyTrait2::my_fn(); //~ ERROR E0790
51 }
52
53 fn main() {}