From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../require-parens-for-chained-comparison.rs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/ui/parser/require-parens-for-chained-comparison.rs (limited to 'tests/ui/parser/require-parens-for-chained-comparison.rs') diff --git a/tests/ui/parser/require-parens-for-chained-comparison.rs b/tests/ui/parser/require-parens-for-chained-comparison.rs new file mode 100644 index 000000000..5b90e905a --- /dev/null +++ b/tests/ui/parser/require-parens-for-chained-comparison.rs @@ -0,0 +1,38 @@ +fn main() { + false == false == false; + //~^ ERROR comparison operators cannot be chained + //~| HELP split the comparison into two + + false == 0 < 2; + //~^ ERROR comparison operators cannot be chained + //~| HELP parenthesize the comparison + + f(); + //~^ ERROR comparison operators cannot be chained + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + + f, Option>>(1, 2); + //~^ ERROR comparison operators cannot be chained + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + + let _ = f(); + //~^ ERROR expected one of + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + + let _ = f<'_, i8>(); + //~^ ERROR expected one of + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + //~| ERROR expected + //~| HELP add `'` to close the char literal + + f<'_>(); + //~^ comparison operators cannot be chained + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + //~| ERROR expected + //~| HELP add `'` to close the char literal + + let _ = f; + //~^ ERROR comparison operators cannot be chained + //~| HELP use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments + //~| HELP or use `(...)` if you meant to specify fn arguments +} -- cgit v1.2.3