Using a value after it is freed

Nothing about ownership waits until the program runs. Check follows each owner through the body and reports a read that happens after the release, naming the value, where it was created, and the line that freed it.

The first read here is fine and the second is not. Move it above text.deinit(), or release with defer text.deinit() instead, so the buffer lives to the end of the block.

fn main() {
  let mut text = Buffer.new()
  println(text.len())
  text.deinit()
  println(text.len())
}
Output & diagnostics
Try Check. Expected diagnostic:
already freed
Ctrl/⌘+Enter checks the current lesson.