]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/method-path-in-pattern.rs
Update const_forget.rs
[rust.git] / src / test / ui / methods / method-path-in-pattern.rs
1 struct Foo;
2
3 impl Foo {
4     fn bar(&self) {}
5 }
6
7 trait MyTrait {
8     fn trait_bar() {}
9 }
10
11 impl MyTrait for Foo {}
12
13 fn main() {
14     match 0u32 {
15         Foo::bar => {}
16         //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
17     }
18     match 0u32 {
19         <Foo>::bar => {}
20         //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
21     }
22     match 0u32 {
23         <Foo>::trait_bar => {}
24         //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::trait_bar`
25     }
26     if let Foo::bar = 0u32 {}
27     //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
28     if let <Foo>::bar = 0u32 {}
29     //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::bar`
30     if let Foo::trait_bar = 0u32 {}
31     //~^ ERROR expected unit struct, unit variant or constant, found method `Foo::trait_bar`
32 }