In general, Rust's single ownership principle makes it very difficult to accidentally put a reference to the same thing several places when you meant to create separate copies.
It technically moves the element from y to x. In this case since f64 implements the Copy trait, it copies it. But if you had a vector of strings, then Rust wouldn't allow you to do this.
let mut x = vec![String::from("hello"), String::from("world")];
let y = vec![String::from("foo"), String::from("bar")];
x[0] = y[0]; // Gives you an error
Thank you for the explaination. I realized I did not declare x as mut, my mistake. As a follow up question, if I have a vec of structs, would it then also copy the struct?
Yes, if it implemented the Copy trait. Rust generally treats types uniformly. It matters much more what traits a type implements; whether it's a struct or an enum or a primitive built-in is usually not very important.