1
0
mirror of https://github.com/bspeice/qadapt synced 2025-07-02 06:16:30 -04:00

Handle return showing up in closures

This commit is contained in:
2018-11-17 10:32:58 -05:00
parent eef377708b
commit 3341faeb91
2 changed files with 28 additions and 2 deletions

View File

@ -132,3 +132,20 @@ fn macro_branching_return() {
assert_eq!(7, branching_return(false, false, true));
assert_eq!(8, branching_return(false, false, false));
}
fn run_closure(x: impl Fn(bool, bool) -> bool) -> bool {
x(true, false)
}
#[allocate_panic]
fn example_closure() {
let c = run_closure(|a: bool, b| return a && b);
assert!(!c);
let x = || return true;
assert!(x());
}
#[test]
fn macro_closure() {
example_closure()
}