New Issue: lifetime checker: records with both an owned and a borrowed field

20523, "vasslitvinov", "lifetime checker: records with both an owned and a borrowed field", "2022-08-26T05:18:24Z"

The following code today generates a lifetime checker error:

class Node { }

record list {
  var head: owned Node?;
  var tail: borrowed Node?;
}

var lst = new list();  // error: Scoped variable lst reachable after lifetime ends

A workaround is to place var lst in a block or a function:

{
  var lst = new list();  // ok
}

This issue requests:

  • at a minimum, add a note to the error message that suggests a workaround
  • ideally, figure out how to deal with records like this for lifetime checking