diff options
Diffstat (limited to 'tests/ui/trait-bounds/argument-with-unnecessary-method-call.rs')
| -rw-r--r-- | tests/ui/trait-bounds/argument-with-unnecessary-method-call.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/argument-with-unnecessary-method-call.rs b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.rs new file mode 100644 index 00000000000..d8fd1d44a98 --- /dev/null +++ b/tests/ui/trait-bounds/argument-with-unnecessary-method-call.rs @@ -0,0 +1,11 @@ +struct Foo; +struct Bar; +impl From<Bar> for Foo { + fn from(_: Bar) -> Self { Foo } +} +fn qux(_: impl From<Bar>) {} +fn main() { + qux(Bar.into()); //~ ERROR type annotations needed + //~| HELP try using a fully qualified path to specify the expected types + //~| HELP consider removing this method call, as the receiver has type `Bar` and `Bar: From<Bar>` trivially holds +} |
