1 // Beginners write `mod.item` when they should write `mod::item`.
2 // This tests that we suggest the latter when we encounter the former.
7 pub fn f() -> i32 { 2 }
12 pub fn g() -> i32 { 4 }
18 //~^ ERROR expected value, found module `a`
19 //~| HELP use the path separator
24 //~^ ERROR expected value, found module `a`
25 //~| HELP use the path separator
30 //~^ ERROR expected value, found module `a`
31 //~| HELP use the path separator
36 //~^ ERROR expected value, found module `a::b`
37 //~| HELP a constant with a similar name exists
38 //~| HELP use the path separator
43 //~^ ERROR expected value, found module `a`
44 //~| HELP use the path separator
47 //~^ ERROR expected value, found module `a::b`
48 //~| HELP a constant with a similar name exists
53 //~^ ERROR expected value, found module `a::b`
54 //~| HELP a constant with a similar name exists
55 //~| HELP use the path separator
60 //~^ ERROR expected value, found module `a::b`
61 //~| HELP a constant with a similar name exists
66 //~^ ERROR expected function, found module `a::b`
67 //~| HELP a constant with a similar name exists
73 //~^ ERROR expected value, found module `a`
74 //~| ERROR expected value, found module `a`
81 //~^ ERROR expected value, found module `a`
82 //~| HELP use the path separator
86 //~^ ERROR expected value, found module `a`
87 //~| HELP use the path separator
93 // Note that if the receiver is a macro call, we do not want to suggest to replace
94 // `.` with `::` as that would be a syntax error.
95 // Since the receiver is a module and not a type, we cannot suggest to surround
96 // it with angle brackets.
99 module!().g::<()>(); // no `help` here!
101 module!().g; // no `help` here!
104 // Ensure that the suggestion is shown for expressions inside of macro definitions.
107 let _ = create!(method);
108 let _ = create!(field);