1. 20

  2. 3

    I had a look around to see how Tree Borrows relates to Stacked Borrows. Looks like there are some problems with Stacked Borrows that Tree Borrows aims to fix. Tree Borrows comes from Ralf Jung’s team; Ralf developed Stacked Borrows.

    I haven’t found a concise outline of the problems with Stacked Borrows and how Tree Borrows addresses them.

    1. 4

      The main sales pitch, at least for me, is the copy_nonoverlapping example. This fixes a particular nasty problem with stacked borrows (the best example I know is this: https://github.com/rust-lang/rust/issues/60847#issuecomment-492558787). I personally hit that more or less every time when I write non-trivial unsafe code.

      1. 1

        Having read the stacked borrows paper, my main beef with them is that the rules for raw pointers are hard to think about. Said paper pointed out that a tree-based model would probably work better here, and I am happy to see this research being done.