From 2ff14448863ac1a1dd9533461708e29aae170c2d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:06:31 +0200 Subject: Adding debian version 1.65.0+dfsg1-2. Signed-off-by: Daniel Baumann --- src/test/ui/resolve/issue-100365.rs | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/test/ui/resolve/issue-100365.rs (limited to 'src/test/ui/resolve/issue-100365.rs') diff --git a/src/test/ui/resolve/issue-100365.rs b/src/test/ui/resolve/issue-100365.rs new file mode 100644 index 000000000..1d8835036 --- /dev/null +++ b/src/test/ui/resolve/issue-100365.rs @@ -0,0 +1,50 @@ +fn main() { + let addr = Into::.into([127, 0, 0, 1]); + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + + let _ = Into.into(()); + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + + let _ = Into::<()>.into; + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator +} + +macro_rules! Trait { + () => { + ::std::iter::Iterator + //~^ ERROR expected value, found trait `std::iter::Iterator` + //~| ERROR expected value, found trait `std::iter::Iterator` + }; +} + +macro_rules! create { + () => { + Into::.into("") + //~^ ERROR expected value, found trait `Into` + //~| HELP use the path separator + }; +} + +fn interaction_with_macros() { + // + // Note that if the receiver is a macro call, we do not want to suggest to replace + // `.` with `::` as that would be a syntax error. + // Since the receiver is a trait and not a type, we cannot suggest to surround + // it with angle brackets. It would be interpreted as a trait object type void of + // `dyn` which is most likely not what the user intended to write. + // `<_ as Trait!()>::` is also not an option as it's equally syntactically invalid. + // + + Trait!().map(std::convert::identity); // no `help` here! + + Trait!().map; // no `help` here! + + // + // Ensure that the suggestion is shown for expressions inside of macro definitions. + // + + let _ = create!(); +} -- cgit v1.2.3