blob: 162bf30c1b6e4b62fd5db94f82a54e0734feb9d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[[Pointer safety principle]]
[[Variables are subject to permissions similar to files on linux]]
[[Lifetime specifier]]
[[When heap data is deallocated]]
[[Variables lives on the stack]]
[[Ownership]]
This is literally talking about heap data and references (ie `&String`): the heap data must not be freed when we try to use a reference to it.
This is enforced in one of two ways.
Firstly, if a reference is created to a variable it loses its Own permission: thus we can't drop it, because the compiler expects that permission on the place where it is dropped.
Secondly, it uses the Flow permission and requires a a lifetime specifier when we return things from functions.
|