diff options
| author | bors <bors@rust-lang.org> | 2024-08-29 02:38:32 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-08-29 02:38:32 +0000 | 
| commit | 6cf068db566de080dfa7ed24a216ea3aed2b98ce (patch) | |
| tree | d51916b4cd8fdc73dd70fdaa1d3e56bb7b1e6ada /tests/ui/threads-sendsync/send-is-not-static-par-for.rs | |
| parent | acb4e8b6251f1d8da36f08e7a70fa23fc581839e (diff) | |
| parent | bd66fadd79ac0d05be85a229ba6d295e50c24ade (diff) | |
| download | rust-6cf068db566de080dfa7ed24a216ea3aed2b98ce.tar.gz rust-6cf068db566de080dfa7ed24a216ea3aed2b98ce.zip | |
Auto merge of #129721 - workingjubilee:rollup-y2o1mnp, r=workingjubilee
Rollup of 14 pull requests Successful merges: - #128192 (rustc_target: Add various aarch64 features) - #129170 (Add an ability to convert between `Span` and `visit::Location`) - #129343 (Emit specific message for time<=0.3.35) - #129378 (Clean up cfg-gating of ProcessPrng extern) - #129401 (Partially stabilize `feature(new_uninit)`) - #129467 (derive(SmartPointer): assume pointee from the single generic and better error messages) - #129494 (format code in tests/ui/threads-sendsync) - #129617 (Update books) - #129673 (Add fmt::Debug to sync::Weak<T, A>) - #129683 (copysign with sign being a NaN can have non-portable results) - #129689 (Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`) - #129695 (Fix path to run clippy on rustdoc) - #129712 (Correct trusty targets to be tier 3) - #129715 (Update `compiler_builtins` to `0.1.123`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/threads-sendsync/send-is-not-static-par-for.rs')
| -rw-r--r-- | tests/ui/threads-sendsync/send-is-not-static-par-for.rs | 17 | 
1 files changed, 7 insertions, 10 deletions
| diff --git a/tests/ui/threads-sendsync/send-is-not-static-par-for.rs b/tests/ui/threads-sendsync/send-is-not-static-par-for.rs index b943b0c433d..dd02166c0fa 100644 --- a/tests/ui/threads-sendsync/send-is-not-static-par-for.rs +++ b/tests/ui/threads-sendsync/send-is-not-static-par-for.rs @@ -1,12 +1,13 @@ //@ run-pass #![allow(unused_imports)] -use std::thread; use std::sync::Mutex; +use std::thread; fn par_for<I, F>(iter: I, f: F) - where I: Iterator, - I::Item: Send, - F: Fn(I::Item) + Sync +where + I: Iterator, + I::Item: Send, + F: Fn(I::Item) + Sync, { for item in iter { f(item) @@ -15,9 +16,7 @@ fn par_for<I, F>(iter: I, f: F) fn sum(x: &[i32]) { let sum_lengths = Mutex::new(0); - par_for(x.windows(4), |x| { - *sum_lengths.lock().unwrap() += x.len() - }); + par_for(x.windows(4), |x| *sum_lengths.lock().unwrap() += x.len()); assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); } @@ -26,9 +25,7 @@ fn main() { let mut elements = [0; 20]; // iterators over references into this stack frame - par_for(elements.iter_mut().enumerate(), |(i, x)| { - *x = i as i32 - }); + par_for(elements.iter_mut().enumerate(), |(i, x)| *x = i as i32); sum(&elements) } | 
