mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
let_chains: Add test protecting the precedence of && in relation to other things.
This commit is contained in:
parent
6a6b07906f
commit
d45dadd951
18
src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs
Normal file
18
src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// run-pass
|
||||
|
||||
#![allow(irrefutable_let_patterns)]
|
||||
|
||||
use std::ops::Range;
|
||||
|
||||
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 {};
|
||||
}
|
||||
assert!(!_f1());
|
||||
}
|
Loading…
Reference in New Issue
Block a user