diff options
| author | bors <bors@rust-lang.org> | 2013-06-15 15:16:17 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-15 15:16:17 -0700 |
| commit | 579c614e38303434bdb2926e192f69db041aec78 (patch) | |
| tree | 22cca87779018f1b67a850a38a5c3586019fdd75 /src/rt/rust_task.cpp | |
| parent | 998e41a11a977413dcfc6716ab936ab9dcecb76d (diff) | |
| parent | f2a7fc69daaa672696641042e97611fbfa0f0013 (diff) | |
| download | rust-579c614e38303434bdb2926e192f69db041aec78.tar.gz rust-579c614e38303434bdb2926e192f69db041aec78.zip | |
auto merge of #7124 : Aatch/rust/trans-refactor-pt1, r=brson
This removes all of the explicit `@mut` fields from `CrateContext`. There are still a few that are managed, but no longer do we have `@mut bool` in the structure. Most of the changes are changing `@CrateContext` to `@mut CrateContext`, though I did change as many as I could get away with to `&CrateContext` and `&mut CrateContext`. The biggest thing preventing me from changing to `&[mut]` in most places was the instruction counter thing. In two cases, where I got a static borrow error and a dynamic borrow error, I opted to remove the count call there as it was literally the only thing preventing me from switching to `&mut CrateContext` parameters in both cases. Other things to note: * the EncoderContext uses borrowed pointers with lifetimes, since it can, though that required me to work around the limitation of not being able to move a structure with borrowed pointers into a heap closure. I changed as much as I could to stack closures, but unfortunately I hit the AST visitor and changing that is somewhat outside the scope of this PR. Instead (and there is a comment to this effect) I choose to unsafely get the structure into the heap, this is because I know the lifetimes involved are safe, even though the compiler can't prove it. * Many of the changes are workarounds because of the borrow checker, either dynamically freezing it for too long, or inferring too large a scope. This is mostly just from nested function calls where each borrow is considered to last for the entire statement. Other cases are where `CrateContext` was borrowed in a `match` causing it to be borrowed for the entire length of the match, even though that wasn't wanted (or needed). * I haven't yet tested to see if this changes compilation times in any way. I doubt there will be much of an impact however, as the only major improvements are less indirection and fewer refcount bumps. * This lays the foundations to remove many more heap allocations in trans as many cases can be changed to use lifetimes instead. ===== This change includes some other, minor refactorings, as I am planning a series, however I don't want to submit them all at once as it will be hell to continually rebase.
Diffstat (limited to 'src/rt/rust_task.cpp')
0 files changed, 0 insertions, 0 deletions
