I'm currently trying to learn Rust, and I'm trying to make a sum function that takes in a generic types list as parameter, calculates the sum and gives it back. However when compiling the code I get the following error:
mispatched types
    expected type parameter `T`, found `&amp;T`
And this happens on the line that says `sum += &amp;val`.
The code itself looks as follows:
use std::io;

use std::ops::AddAssign;

fn sum_list + Default&gt;(list: &amp;[T]) -&gt; T {
    let mut sum: T = T::default();
    for &amp;val in list.iter() {
        sum += &amp;val;
    }
    sum
}

fn main() {
    let num_list = vec![1,2,3,4,5];
    println!("Sum of list = {}", sum_list(&amp;num_list));
}

How would I go around fixing this bug?