diff options
| author | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2022-06-15 03:12:07 +0200 |
|---|---|---|
| committer | Frank Steffahn <frank.steffahn@stu.uni-kiel.de> | 2022-06-15 11:54:59 +0200 |
| commit | eb14dd863a0d8af603c6783b10efff8454944c15 (patch) | |
| tree | 056913c22ce64e02f01a41eb3b830e74e91baf1d /library/std/src | |
| parent | 1f34da9ec8a85b6f86c5fa1c121ab6f88f2f4966 (diff) | |
| download | rust-eb14dd863a0d8af603c6783b10efff8454944c15.tar.gz rust-eb14dd863a0d8af603c6783b10efff8454944c15.zip | |
Test NLL fix of bad lifetime inference for reference captured in closure.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/thread/tests.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/library/std/src/thread/tests.rs b/library/std/src/thread/tests.rs index 5b8309cf5d2..ec68b529188 100644 --- a/library/std/src/thread/tests.rs +++ b/library/std/src/thread/tests.rs @@ -316,3 +316,16 @@ fn test_scoped_threads_drop_result_before_join() { }); 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); +} |
