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/ty | |
| 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/ty')
| -rw-r--r-- | src/librustc/ty/context.rs | 14 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 776ae7dc141..07d86a5f86a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -22,7 +22,7 @@ use crate::middle::cstore::EncodedMetadata; use crate::middle::lang_items; use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use crate::middle::stability; -use crate::mir::{Body, Field, interpret, Local, Place, PlaceElem, ProjectionKind, Promoted}; +use crate::mir::{BodyCache, Field, interpret, Local, Place, PlaceElem, ProjectionKind, Promoted}; use crate::mir::interpret::{ConstValue, Allocation, Scalar}; use crate::ty::subst::{GenericArg, InternalSubsts, SubstsRef, Subst}; use crate::ty::ReprOptions; @@ -1083,17 +1083,17 @@ impl<'tcx> TyCtxt<'tcx> { &self.hir_map } - pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> { - self.arena.alloc(Steal::new(mir)) + pub fn alloc_steal_mir(self, mir_cache: BodyCache<'tcx>) -> &'tcx Steal<BodyCache<'tcx>> { + self.arena.alloc(Steal::new(mir_cache)) } - pub fn alloc_steal_promoted(self, promoted: IndexVec<Promoted, Body<'tcx>>) -> - &'tcx Steal<IndexVec<Promoted, Body<'tcx>>> { + pub fn alloc_steal_promoted(self, promoted: IndexVec<Promoted, BodyCache<'tcx>>) -> + &'tcx Steal<IndexVec<Promoted, BodyCache<'tcx>>> { self.arena.alloc(Steal::new(promoted)) } - pub fn intern_promoted(self, promoted: IndexVec<Promoted, Body<'tcx>>) -> - &'tcx IndexVec<Promoted, Body<'tcx>> { + pub fn intern_promoted(self, promoted: IndexVec<Promoted, BodyCache<'tcx>>) -> + &'tcx IndexVec<Promoted, BodyCache<'tcx>> { self.arena.alloc(promoted) } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 8ccfc467f4a..f8feff0def9 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -18,7 +18,7 @@ use crate::infer::canonical::Canonical; use crate::middle::cstore::CrateStoreDyn; use crate::middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem}; use crate::middle::resolve_lifetime::ObjectLifetimeDefault; -use crate::mir::Body; +use crate::mir::ReadOnlyBodyCache; use crate::mir::interpret::{GlobalId, ErrorHandled}; use crate::mir::GeneratorLayout; use crate::session::CrateDisambiguator; @@ -2985,10 +2985,10 @@ impl<'tcx> TyCtxt<'tcx> { } /// Returns the possibly-auto-generated MIR of a `(DefId, Subst)` pair. - pub fn instance_mir(self, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { + pub fn instance_mir(self, instance: ty::InstanceDef<'tcx>) -> ReadOnlyBodyCache<'tcx, 'tcx> { match instance { ty::InstanceDef::Item(did) => { - self.optimized_mir(did) + self.optimized_mir(did).read_only() } ty::InstanceDef::VtableShim(..) | ty::InstanceDef::ReifyShim(..) | @@ -2998,7 +2998,7 @@ impl<'tcx> TyCtxt<'tcx> { ty::InstanceDef::ClosureOnceShim { .. } | ty::InstanceDef::DropGlue(..) | ty::InstanceDef::CloneShim(..) => { - self.mir_shims(instance) + self.mir_shims(instance).read_only() } } } @@ -3023,7 +3023,7 @@ impl<'tcx> TyCtxt<'tcx> { } pub fn generator_layout(self, def_id: DefId) -> &'tcx GeneratorLayout<'tcx> { - self.optimized_mir(def_id).generator_layout.as_ref().unwrap() + self.optimized_mir(def_id).body().generator_layout.as_ref().unwrap() } /// Given the `DefId` of an impl, returns the `DefId` of the trait it implements. |
