From 13e1faf060b5047724944cdd183df9401f0104b0 Mon Sep 17 00:00:00 2001 From: lukaszKielar <kielar.lukasz@hotmail.com> Date: Mon, 29 Jun 2020 22:44:31 +0200 Subject: [PATCH] finish arc1 exercise --- exercises/standard_library_types/arc1.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/exercises/standard_library_types/arc1.rs b/exercises/standard_library_types/arc1.rs index 07932c6..180d85a 100644 --- a/exercises/standard_library_types/arc1.rs +++ b/exercises/standard_library_types/arc1.rs @@ -4,18 +4,17 @@ // somewhere. Try not to create any copies of the `numbers` Vec! // Execute `rustlings hint arc1` for hints :) -// I AM NOT DONE - #![forbid(unused_imports)] // Do not change this, (or the next) line. use std::sync::Arc; use std::thread; fn main() { let numbers: Vec<_> = (0..100u32).collect(); - let shared_numbers = // TODO + let shared_numbers = Arc::new(numbers); let mut joinhandles = Vec::new(); for offset in 0..8 { + let child_numbers = Arc::clone(&shared_numbers); joinhandles.push(thread::spawn(move || { let mut i = offset; let mut sum = 0;