|
|
|
|
|
by Buttons840
867 days ago
|
|
Isn't this a definition of lifetimes too? A lifetime is some set of memory a reference may refer to. Consider: fn foo<'a, 'b>(x: &'a str, y: &'b str) -> &'a str Aren't 'a and 'b sets of memory a reference can refer to? As far as this function call is concerned, both 'a and 'b will live throughout, so it's not about life and death, it's about what memory the references may refer too. Is a lifetime and a "provenance" the same thing? |
|
Lifetimes are a static approximation of provenance. They are erased after being validated by the borrow checker, and do not exist in Miri or have any impact on what transformations the optimizer may perform. In other words, the provenance rules allow a superset of what the borrow checker allows.