]> git.lizzy.rs Git - rust.git/blob - tests/ui/resolve/issue-22692.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / resolve / issue-22692.rs
1 fn main() {
2     let _ = String.new();
3     //~^ ERROR expected value, found struct `String`
4     //~| HELP use the path separator
5
6     let _ = String.default;
7     //~^ ERROR expected value, found struct `String`
8     //~| HELP use the path separator
9
10     let _ = Vec::<()>.with_capacity(1);
11     //~^ ERROR expected value, found struct `Vec`
12     //~| HELP use the path separator
13 }
14
15 macro_rules! Type {
16     () => {
17         ::std::cell::Cell
18         //~^ ERROR expected value, found struct `std::cell::Cell`
19         //~| ERROR expected value, found struct `std::cell::Cell`
20         //~| ERROR expected value, found struct `std::cell::Cell`
21     };
22 }
23
24 macro_rules! create {
25     (type method) => {
26         Vec.new()
27         //~^ ERROR expected value, found struct `Vec`
28         //~| HELP use the path separator
29     };
30     (type field) => {
31         Vec.new
32         //~^ ERROR expected value, found struct `Vec`
33         //~| HELP use the path separator
34     };
35     (macro method) => {
36         Type!().new(0)
37         //~^ HELP use the path separator
38     };
39 }
40
41 fn interaction_with_macros() {
42     //
43     // Verify that we do not only suggest to replace `.` with `::` if the receiver is a
44     // macro call but that we also correctly suggest to surround it with angle brackets.
45     //
46
47     Type!().get();
48     //~^ HELP use the path separator
49
50     Type! {}.get;
51     //~^ HELP use the path separator
52
53     //
54     // Ensure that the suggestion is shown for expressions inside of macro definitions.
55     //
56
57     let _ = create!(type method);
58     let _ = create!(type field);
59     let _ = create!(macro method);
60 }