rust
Does if-let with a pair short-circuit?
Suppose f() and g() return Option<T>. if let (Some(x), Some(y)) = (f(), g()) { h(); } If f() returns None, will g() be evaluated? Is evaluation guaranteed or prohibited by the spec?
It does not shortcut. To pattern-match against the pair, the pair must be fully constructed, which means both f and g have been called. There is no lazy evaluation where the pattern match could happen before the values are calculated. (By the way, it's easy to try out, and the Rust compiler pretty much is the spec right now.)
Related Links
How to make a simple futures::sync::mpsc::channel example work?
Is there a way to let Rust infer the correct type for an associated type?
How to encapsulate resources and their references in one struct in Rust? [duplicate]
How would one return a function from a function in Rust?
Lifetime on trait returning iterator
Mutable borrow of self doesn't change to immutable
How do I specify the linker path in Rust?
Are raw pointers to temporaries ok in Rust?
How to destructure tuple struct with reference
Unable to use std::process::Command to SSH - No such file or directory
“borrowed value does not live long enough” error in trie insertion
How to check for EOF in read_line in Rust 1.12?
Can I create an owned pointer to a stack object
How do I abort a Rust process?
Is it possible to disable Rust's lifetime elision?
How to implement Index over a wrapped HashMap?