mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Test NLL fix of bad lifetime inference for reference captured in closure.
This commit is contained in:
parent
1f34da9ec8
commit
eb14dd863a
@ -316,3 +316,16 @@ fn test_scoped_threads_drop_result_before_join() {
|
|||||||
});
|
});
|
||||||
assert!(actually_finished.load(Ordering::Relaxed));
|
assert!(actually_finished.load(Ordering::Relaxed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_scoped_threads_nll() {
|
||||||
|
// this is mostly a *compilation test* for this exact function:
|
||||||
|
fn foo(x: &u8) {
|
||||||
|
thread::scope(|s| {
|
||||||
|
s.spawn(|| drop(x));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// let's also run it for good measure
|
||||||
|
let x = 42_u8;
|
||||||
|
foo(&x);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user