diff options
| author | Paul Daniel Faria <Nashenas88@users.noreply.github.com> | 2019-10-26 01:41:17 -0400 |
|---|---|---|
| committer | Paul Daniel Faria <Nashenas88@users.noreply.github.com> | 2019-12-02 08:35:08 -0500 |
| commit | fc6b58d0a809b4994cd1a633ccb04e89234ff0b8 (patch) | |
| tree | 61c0f5dd280467c5f8e3e16c527711732bf682d4 /src/librustc/query/mod.rs | |
| parent | 38c0887c769b227c827c76d80fa76fc5e4493516 (diff) | |
| download | rust-fc6b58d0a809b4994cd1a633ccb04e89234ff0b8.tar.gz rust-fc6b58d0a809b4994cd1a633ccb04e89234ff0b8.zip | |
Simplify BodyCache impl and fix all remaining type errors in librustc_mir (lifetime errors still exist)
Diffstat (limited to 'src/librustc/query/mod.rs')
| -rw-r--r-- | src/librustc/query/mod.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index d715ddb1b81..cdfdcee5823 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -106,42 +106,46 @@ rustc_queries! { /// Fetch the MIR for a given `DefId` right after it's built - this includes /// unreachable code. - query mir_built(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {} + query mir_built(_: DefId) -> &'tcx Steal<mir::BodyCache<'tcx>> {} /// Fetch the MIR for a given `DefId` up till the point where it is /// ready for const evaluation. /// /// See the README for the `mir` module for details. - query mir_const(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> { + query mir_const(_: DefId) -> &'tcx Steal<mir::BodyCache<'tcx>> { no_hash } query mir_validated(_: DefId) -> ( - &'tcx Steal<mir::Body<'tcx>>, - &'tcx Steal<IndexVec<mir::Promoted, mir::Body<'tcx>>> + &'tcx Steal<mir::BodyCache<'tcx>>, + &'tcx Steal<IndexVec<mir::Promoted, mir::BodyCache<'tcx>>> ) { no_hash } /// MIR after our optimization passes have run. This is MIR that is ready /// for codegen. This is also the only query that can fetch non-local MIR, at present. - query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> { + query optimized_mir(key: DefId) -> &'tcx mir::BodyCache<'tcx> { cache_on_disk_if { key.is_local() } load_cached(tcx, id) { - let mir: Option<crate::mir::Body<'tcx>> = tcx.queries.on_disk_cache - .try_load_query_result(tcx, id); - mir.map(|x| &*tcx.arena.alloc(x)) + let mir: Option<crate::mir::BodyCache<'tcx>> + = tcx.queries.on_disk_cache.try_load_query_result(tcx, id); + mir.map(|x| { + let cache = tcx.arena.alloc(x); + cache.ensure_predecessors(); + &*cache + }) } } - query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::Body<'tcx>> { + query promoted_mir(key: DefId) -> &'tcx IndexVec<mir::Promoted, mir::BodyCache<'tcx>> { cache_on_disk_if { key.is_local() } load_cached(tcx, id) { let promoted: Option< rustc_index::vec::IndexVec< crate::mir::Promoted, - crate::mir::Body<'tcx> + crate::mir::BodyCache<'tcx> >> = tcx.queries.on_disk_cache.try_load_query_result(tcx, id); promoted.map(|p| &*tcx.arena.alloc(p)) } @@ -502,7 +506,7 @@ rustc_queries! { /// in the case of closures, this will be redirected to the enclosing function. query region_scope_tree(_: DefId) -> &'tcx region::ScopeTree {} - query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Body<'tcx> { + query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::BodyCache<'tcx> { no_force desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) } } |
