]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/assoc-ct-for-assoc-method.rs
Rollup merge of #106751 - clubby789:const-intrinsic, r=GuillaumeGomez
[rust.git] / tests / ui / suggestions / assoc-ct-for-assoc-method.rs
1 struct MyS;
2
3 impl MyS {
4     const FOO: i32 = 1;
5     fn foo() -> MyS {
6         MyS
7     }
8 }
9
10 fn main() {
11     let x: i32 = MyS::foo;
12     //~^ ERROR mismatched types
13     //~| HELP try referring to the
14
15     let z: i32 = i32::max;
16     //~^ ERROR mismatched types
17     //~| HELP try referring to the
18
19     // This example is still broken though... This is a hard suggestion to make,
20     // because we don't have access to the associated const probing code to make
21     // this suggestion where it's emitted, i.e. in trait selection.
22     let y: i32 = i32::max - 42;
23     //~^ ERROR cannot subtract
24     //~| HELP use parentheses
25 }