2 let addr = Into::<std::net::IpAddr>.into([127, 0, 0, 1]);
3 //~^ ERROR expected value, found trait `Into`
4 //~| HELP use the path separator
7 //~^ ERROR expected value, found trait `Into`
8 //~| HELP use the path separator
10 let _ = Into::<()>.into;
11 //~^ ERROR expected value, found trait `Into`
12 //~| HELP use the path separator
18 //~^ ERROR expected value, found trait `std::iter::Iterator`
19 //~| ERROR expected value, found trait `std::iter::Iterator`
25 Into::<String>.into("")
26 //~^ ERROR expected value, found trait `Into`
27 //~| HELP use the path separator
31 fn interaction_with_macros() {
33 // Note that if the receiver is a macro call, we do not want to suggest to replace
34 // `.` with `::` as that would be a syntax error.
35 // Since the receiver is a trait and not a type, we cannot suggest to surround
36 // it with angle brackets. It would be interpreted as a trait object type void of
37 // `dyn` which is most likely not what the user intended to write.
38 // `<_ as Trait!()>::` is also not an option as it's equally syntactically invalid.
41 Trait!().map(std::convert::identity); // no `help` here!
43 Trait!().map; // no `help` here!
46 // Ensure that the suggestion is shown for expressions inside of macro definitions.