Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[1/n] Move the MIR map into the type context. #37400
Conversation
rust-highfive
assigned
pnkfelix
Oct 25, 2016
This comment has been minimized.
This comment has been minimized.
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
eddyb
referenced this pull request
Oct 25, 2016
Merged
[2/n] rustc_metadata: move is_extern_item to trans. #37401
eddyb
force-pushed the
eddyb:lazy-1
branch
from
c4f4ecd
to
0848ae2
Oct 25, 2016
nikomatsakis
approved these changes
Oct 25, 2016
| adt_defs: TypedArena<ty::AdtDefData<'tcx, 'tcx>>, | ||
| trait_def: TypedArena<ty::TraitDef<'tcx>>, | ||
| adt_def: TypedArena<ty::AdtDefData<'tcx, 'tcx>>, | ||
| mir: TypedArena<RefCell<Mir<'tcx>>>, |
This comment has been minimized.
This comment has been minimized.
| let mir = self.alloc_mir(mir); | ||
|
|
||
| // Perma-borrow MIR from extern crates to prevent mutation. | ||
| mem::forget(mir.borrow()); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
force-pushed the
eddyb:lazy-1
branch
from
0848ae2
to
52d08e2
Oct 28, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
|
eddyb
force-pushed the
eddyb:lazy-1
branch
from
52d08e2
to
e34792b
Oct 28, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors r=nikomatsakis |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Oct 30, 2016
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Oct 30, 2016
bors
merged commit e34792b
into
rust-lang:master
Oct 30, 2016
This was referenced Oct 30, 2016
Closed
plietar
added a commit
to plietar/miri
that referenced
this pull request
Nov 4, 2016
eddyb
deleted the
eddyb:lazy-1
branch
Nov 9, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
eddyb commentedOct 25, 2016
•
edited
This is part of a series (prev | next) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. MIR-based early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.
The first commit reorganizes the
rustc::mirmodule to contain the MIR types directly without an extraneousreprmodule which serves no practical purpose but is rather an eyesore.The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through
TyCtxt.Local
Mirbodies need to be mutated by passes (henceRefCell), and at least one pass (qualify_consts) needs simultaneous access to multipleMirbodies (hence arena-allocation).Mirbodies loaded from other crates appear as if immutably borrowed (by.borrow()-ing oneRefand subsequently "leaking" it) to avoid, at least dynamically, any possibility of their local mutation.One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous).
However, lints are unstable anyway and we can find a way to deal with this in due time.
Future work will result in a tighter API, potentially hiding mutation completely outside of MIR passes.