]> git.lizzy.rs Git - rust.git/blob - tests/ui/methods/method-path-in-pattern.rs
Rollup merge of #107499 - compiler-errors:deduce_sig_from_projection-generator-tweak...
[rust.git] / tests / 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 associated function
17     }
18     match 0u32 {
19         <Foo>::bar => {}
20         //~^ ERROR expected unit struct, unit variant or constant, found associated function
21     }
22     match 0u32 {
23         <Foo>::trait_bar => {}
24         //~^ ERROR expected unit struct, unit variant or constant, found associated function
25     }
26     if let Foo::bar = 0u32 {}
27     //~^ ERROR expected unit struct, unit variant or constant, found associated function
28     if let <Foo>::bar = 0u32 {}
29     //~^ ERROR expected unit struct, unit variant or constant, found associated function
30     if let Foo::trait_bar = 0u32 {}
31     //~^ ERROR expected unit struct, unit variant or constant, found associated function
32 }