Closed
Description
This code, as expected, fails to compile:
let x = vec![0];
let y = &x[0];
drop(x);
drop(y);
with
error: cannot move out of `x` because it is borrowed
But this code compiles just fine:
let x = vec![0];
let y = &x[0];
drop(x);
let _ = y;
even though y
is "used" after its referent has been dropped. Is this expected behavior?
Metadata
Metadata
Assignees
Labels
No labels