]> git.lizzy.rs Git - rust.git/blob - tests/ui/span/impl-wrong-item-for-trait.rs
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / span / impl-wrong-item-for-trait.rs
1 use std::fmt::Debug;
2
3 trait Foo {
4     fn bar(&self);
5     const MY_CONST: u32;
6 }
7
8 pub struct FooConstForMethod;
9
10 impl Foo for FooConstForMethod {
11     //~^ ERROR E0046
12     const bar: u64 = 1;
13     //~^ ERROR E0323
14     const MY_CONST: u32 = 1;
15 }
16
17 pub struct FooMethodForConst;
18
19 impl Foo for FooMethodForConst {
20     //~^ ERROR E0046
21     fn bar(&self) {}
22     fn MY_CONST() {}
23     //~^ ERROR E0324
24 }
25
26 pub struct FooTypeForMethod;
27
28 impl Foo for FooTypeForMethod {
29     //~^ ERROR E0046
30     type bar = u64;
31     //~^ ERROR E0325
32     const MY_CONST: u32 = 1;
33 }
34
35 impl Debug for FooTypeForMethod {}
36 //~^ ERROR E0046
37
38 fn main() {}