]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/build/expr/as_place.rs
Remove PlaceBase enum and make Place base field be local: Local
[rust.git] / src / librustc_mir / build / expr / as_place.rs
index a39ab747094be59fe98466e5cd101af603c3bd11..eb2e87f4a2d419526f89154dfcb9de6e4707b567 100644 (file)
@@ -8,7 +8,7 @@
 use rustc::mir::interpret::PanicInfo::BoundsCheck;
 use rustc::mir::*;
 use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, TyCtxt, Variance};
-use syntax_pos::Span;
+use rustc_span::Span;
 
 use rustc_index::vec::Idx;
 
 /// and `c` can be progressively pushed onto the place builder that is created when converting `a`.
 #[derive(Clone)]
 struct PlaceBuilder<'tcx> {
-    base: PlaceBase<'tcx>,
+    local: Local,
     projection: Vec<PlaceElem<'tcx>>,
 }
 
 impl PlaceBuilder<'tcx> {
     fn into_place(self, tcx: TyCtxt<'tcx>) -> Place<'tcx> {
-        Place { base: self.base, projection: tcx.intern_place_elems(&self.projection) }
+        Place { local: self.local, projection: tcx.intern_place_elems(&self.projection) }
     }
 
     fn field(self, f: Field, ty: Ty<'tcx>) -> Self {
@@ -49,13 +49,7 @@ fn project(mut self, elem: PlaceElem<'tcx>) -> Self {
 
 impl From<Local> for PlaceBuilder<'tcx> {
     fn from(local: Local) -> Self {
-        Self { base: local.into(), projection: Vec::new() }
-    }
-}
-
-impl From<PlaceBase<'tcx>> for PlaceBuilder<'tcx> {
-    fn from(base: PlaceBase<'tcx>) -> Self {
-        Self { base, projection: Vec::new() }
+        Self { local, projection: Vec::new() }
     }
 }
 
@@ -370,7 +364,7 @@ fn add_fake_borrows_of_base(
     ) {
         let tcx = self.hir.tcx();
         let place_ty =
-            Place::ty_from(&base_place.base, &base_place.projection, &self.local_decls, tcx);
+            Place::ty_from(&base_place.local, &base_place.projection, &self.local_decls, tcx);
         if let ty::Slice(_) = place_ty.ty.kind {
             // We need to create fake borrows to ensure that the bounds
             // check that we just did stays valid. Since we can't assign to
@@ -380,7 +374,7 @@ fn add_fake_borrows_of_base(
                 match elem {
                     ProjectionElem::Deref => {
                         let fake_borrow_deref_ty = Place::ty_from(
-                            &base_place.base,
+                            &base_place.local,
                             &base_place.projection[..idx],
                             &self.local_decls,
                             tcx,
@@ -398,14 +392,14 @@ fn add_fake_borrows_of_base(
                             Rvalue::Ref(
                                 tcx.lifetimes.re_erased,
                                 BorrowKind::Shallow,
-                                Place { base: base_place.base.clone(), projection },
+                                Place { local: base_place.local.clone(), projection },
                             ),
                         );
                         fake_borrow_temps.push(fake_borrow_temp);
                     }
                     ProjectionElem::Index(_) => {
                         let index_ty = Place::ty_from(
-                            &base_place.base,
+                            &base_place.local,
                             &base_place.projection[..idx],
                             &self.local_decls,
                             tcx,