summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs')
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs
new file mode 100644
index 000000000..fcc09b159
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/protect-precedences.rs
@@ -0,0 +1,17 @@
+// run-pass
+
+#![allow(irrefutable_let_patterns)]
+
+fn main() {
+ let x: bool;
+ // This should associate as: `(x = (true && false));`.
+ x = true && false;
+ assert!(!x);
+
+ fn _f1() -> bool {
+ // Should associate as `(let _ = (return (true && false)))`.
+ if let _ = return true && false {};
+ //~^ WARNING unreachable block in `if`
+ }
+ assert!(!_f1());
+}