Polonius and initialization
Java has some check like this:

void foo() {
  int i;
  System.out.println("" + i); // uninitialized variable
}

Rust:

fn foo() {
  let i: u32;

  println!("{}", i); // error  
}

fn foo() {
  let v: Vec<u32> = vec![];
  drop(v); // moved out of `v` -- "deinitialization"
  println!("{:?}", v); // error  
}

We also allow you to move (“deinitialize”) a path:

fn foo() {
  let tuple: (Vec<u32>, Vec<u32>) = (vec![], vec![]);
  drop(tuple.0); // moved out of `v` -- "deinitialization"
  println!("{:?}", tuple.0); // error  
  println!("{:?}", tuple.1); // OK
}

We don’t allow moves from all possible paths:

struct Bar { v: Vec<u32> }
impl Drop for Bar { }

fn foo() {
  let tuple: &Vec<u32> = ...;
  drop(*tuple); // error

  let b: Bar = Bar { v: vec![] };
  drop(b.v); // error

  let b: [Bar; 2] = ...;
  drop(b[0]); // error
}

Dynamic drop


fn far() {