//Iterator::sum was stabilized in Rust 1.11.0. You can get an iterator from //your array/slice/Vec and then use sum: fn main() { let a = [1, 2, 3, 4, 5]; let sum: u8 = a.iter().sum(); println!("the total sum is: {}", sum); }