]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_ssa/meth.rs
All Builder methods now take &mut self instead of &self
[rust.git] / src / librustc_codegen_ssa / meth.rs
index 4584adfff65daf122277005bfaa49d284ebbbdac..ea573640da9a8122e9bb938cf78314a16a3f7ba0 100644 (file)
@@ -30,7 +30,7 @@ pub fn from_index(index: usize) -> Self {
 
     pub fn get_fn<Bx: BuilderMethods<'a, 'tcx>>(
         self,
-        bx: &Bx,
+        bx: &mut Bx,
         llvtable: Bx::Value,
         fn_ty: &FnType<'tcx, Ty<'tcx>>
     ) -> Bx::Value {
@@ -42,10 +42,8 @@ pub fn get_fn<Bx: BuilderMethods<'a, 'tcx>>(
             bx.cx().type_ptr_to(bx.cx().fn_ptr_backend_type(fn_ty))
         );
         let ptr_align = bx.tcx().data_layout.pointer_align;
-        let ptr = bx.load(
-            bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]),
-            ptr_align
-        );
+        let gep = bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]);
+        let ptr = bx.load(gep, ptr_align);
         bx.nonnull_metadata(ptr);
         // Vtable loads are invariant
         bx.set_invariant_load(ptr);
@@ -54,7 +52,7 @@ pub fn get_fn<Bx: BuilderMethods<'a, 'tcx>>(
 
     pub fn get_usize<Bx: BuilderMethods<'a, 'tcx>>(
         self,
-        bx: &Bx,
+        bx: &mut Bx,
         llvtable: Bx::Value
     ) -> Bx::Value {
         // Load the data pointer from the object.
@@ -62,10 +60,8 @@ pub fn get_usize<Bx: BuilderMethods<'a, 'tcx>>(
 
         let llvtable = bx.pointercast(llvtable, bx.cx().type_ptr_to(bx.cx().type_isize()));
         let usize_align = bx.tcx().data_layout.pointer_align;
-        let ptr = bx.load(
-            bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]),
-            usize_align
-        );
+        let gep = bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]);
+        let ptr = bx.load(gep, usize_align);
         // Vtable loads are invariant
         bx.set_invariant_load(ptr);
         ptr