1. 25
  1.  

  2. 3
    let v:Vec<i32> = Vec::new();
    let v1 = v;//v1 is the new owner
    

    […]

    When the variable v is moved to v1, the object on the stack is bitwise copied:

    I’m not sure that’s the best example, as in a case like that the copy is going to be elided and v1 is going to refer to the same location no the stack as v, so no copying really occurs.

    EDIT: presuming optimisations are turned on.

    1. 5

      I think that’s potentially a good thing to place in a footnote such as:

      In this trivial example, Rust is potentially smart enough to figure out that v and v1 are the same, and thus save the stack space by eliding the copy entirely when optimizations are turned on. However, using v.len() will still cause a “use after move” error regardless of the underlying memory optimizations.

      In general I think the spirit of what is being taught here is accurate.