]> git.proxmox.com Git - cargo.git/commit
Auto merge of #8068 - ehuss:bcx-units, r=alexcrichton,ehuss
authorbors <bors@rust-lang.org>
Sun, 19 Apr 2020 17:37:59 +0000 (17:37 +0000)
committerbors <bors@rust-lang.org>
Sun, 19 Apr 2020 17:37:59 +0000 (17:37 +0000)
commit3dcfdeff274389823256bb5aa828abc49d79c473
tree1435ff187a6a3aade88f77b57d369fc2b929d0cb
parent8e8c62b1c5a290cf0e3540fc16b93e2811c258ec
parentdf5cb70e7bc8872216af736f108f5a959a6d2302
Auto merge of #8068 - ehuss:bcx-units, r=alexcrichton,ehuss

Refactor BuildContext

This restructures the "front end" of the compile process so that the `UnitGraph` can be accessed by API users. Essentially, the `BuildContext` contains the result of generating the `UnitGraph`, and other bits of information collected along the way. This logically separates the build process into two phases: (1) generate the `UnitGraph` and `BuildContext` and (2) pass the `BuildContext` to `Context` which performs the actual compilation.

The main challenge here is dealing with the references and lifetimes. The old code kept a bunch of things on the stack with various layers of references. Beside reorganizing things, the big change is to wrap `Package` and `Target` in `Rc`. This still requires the `UnitInterner` to be passed in and kept alive. It is possible to avoid that by placing all `Unit`s in `Rc`, but that had a roughly 5% performance hit (on fresh builds) because Units are very optimized to be used as hashable keys, and `Rc` loses those optimizations.