Stuck with borrowing

I get Error 0505 on this snip:

		let ps0 = expand(ps[0]);
		let ps1 = expand(ps[1]);
		println!("The product of {:?} and {:?} is {:?}",
			ps0, ps1, product(ps0, ps1))

All variables are of type Vec<u8>.
The function product does NOT change its arguments, and the compiler should know that. Still, this does not compile. What do I do wrong?

What are the signatures of expand() and product().
Also you are missing a ; on your println!

Note : your call to product() will consume both of your vecs. You can't borrow them to println them because they are gone into product(). Maybe send a reference to the vecs to your product() function and change it's signature to accept two "& Vec"

2 Likes

@stonerfish That worked! Thx