移动是否会导致堆栈中涉及的数据的副本,同时保留对堆的所有引用?以下示例似乎表明情况如此:
use std::sync::{Arc};
struct A { v: Vec<u32> }
fn main() {
let a = A { v: vec![42] };
println!("{:p} {:p}", &a.v, &a.v[0]);
let a_moved = a;
println!("{:p} {:p}", &a_moved.v, &a_moved.v[0]);
let arc_a_moved = Arc::new(a_moved);
println!("{:p} {:p}", &arc_a_moved.clone().v, &arc_a_moved.clone().v[0]);
}