about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Daniel Faria <Nashenas88@users.noreply.github.com>2019-11-04 19:52:19 -0500
committerPaul Daniel Faria <Nashenas88@users.noreply.github.com>2019-12-02 08:38:16 -0500
commitc42bdb8c7465389a4d71d88ff8d910d6307be9ba (patch)
tree1e0e74b119291959103f9963dfc4c5685e377eda /src
parente54c610f8543348b92665a86f0c642bdfbd75197 (diff)
downloadrust-c42bdb8c7465389a4d71d88ff8d910d6307be9ba.tar.gz
rust-c42bdb8c7465389a4d71d88ff8d910d6307be9ba.zip
Undo minor changes that weren't needed, fix one lifetime typo
Diffstat (limited to 'src')
-rw-r--r--src/librustc_codegen_ssa/mir/analyze.rs9
-rw-r--r--src/librustc_codegen_ssa/mir/block.rs38
-rw-r--r--src/librustc_codegen_ssa/mir/mod.rs7
-rw-r--r--src/librustc_codegen_ssa/mir/rvalue.rs6
-rw-r--r--src/librustc_data_structures/graph/reference.rs1
5 files changed, 31 insertions, 30 deletions
diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs
index 5609047c5c4..d6fa67b0533 100644
--- a/src/librustc_codegen_ssa/mir/analyze.rs
+++ b/src/librustc_codegen_ssa/mir/analyze.rs
@@ -17,13 +17,14 @@ use super::FunctionCx;
 use crate::traits::*;
 
 pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
-    fx: &FunctionCx<'a, 'tcx, Bx>
+    fx: &FunctionCx<'a, 'tcx, Bx>,
 ) -> BitSet<mir::Local> {
+    let mir = fx.mir;
     let mut analyzer = LocalAnalyzer::new(fx);
 
-    analyzer.visit_body(fx.mir);
+    analyzer.visit_body(mir);
 
-    for (local, decl) in fx.mir.local_decls.iter_enumerated()
+    for (local, decl) in mir.local_decls.iter_enumerated()
     {
         // FIXME(eddyb): We should figure out how to use llvm.dbg.value instead
         // of putting everything in allocas just so we can use llvm.dbg.declare.
@@ -65,7 +66,7 @@ struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
     first_assignment: IndexVec<mir::Local, Location>,
 }
 
-impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
+impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
     fn new(fx: &'mir FunctionCx<'a, 'tcx, Bx>) -> Self {
         let invalid_location =
             mir::BasicBlock::new(fx.mir.basic_blocks().len()).start_location();
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs
index f661e7bba80..2d41c8426de 100644
--- a/src/librustc_codegen_ssa/mir/block.rs
+++ b/src/librustc_codegen_ssa/mir/block.rs
@@ -46,7 +46,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
     fn lltarget<'b, 'c, Bx: BuilderMethods<'b, 'tcx>>(
         &self,
         fx: &'c mut FunctionCx<'b, 'tcx, Bx>,
-        target: mir::BasicBlock
+        target: mir::BasicBlock,
     ) -> (Bx::BasicBlock, bool) {
         let span = self.terminator.source_info.span;
         let lltarget = fx.blocks[target];
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
     fn llblock<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>(
         &self,
         fx: &'c mut FunctionCx<'b, 'tcx, Bx>,
-        target: mir::BasicBlock
+        target: mir::BasicBlock,
     ) -> Bx::BasicBlock {
         let (lltarget, is_cleanupret) = self.lltarget(fx, target);
         if is_cleanupret {
@@ -153,7 +153,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
     // a loop.
     fn maybe_sideeffect<'b, 'tcx2: 'b, Bx: BuilderMethods<'b, 'tcx2>>(
         &self,
-        mir: mir::ReadOnlyBodyCache<'_, 'tcx>,
+        mir: mir::ReadOnlyBodyCache<'b, 'tcx>,
         bx: &mut Bx,
         targets: &[mir::BasicBlock],
     ) {
@@ -173,9 +173,9 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
 /// Codegen implementations for some terminator variants.
 impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
     /// Generates code for a `Resume` terminator.
-    fn codegen_resume_terminator<'c>(
+    fn codegen_resume_terminator<'b>(
         &mut self,
-        helper: TerminatorCodegenHelper<'c, 'tcx>,
+        helper: TerminatorCodegenHelper<'b, 'tcx>,
         mut bx: Bx,
     ) {
         if let Some(funclet) = helper.funclet(self) {
@@ -201,9 +201,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         }
     }
 
-    fn codegen_switchint_terminator<'c>(
+    fn codegen_switchint_terminator<'b>(
         &mut self,
-        helper: TerminatorCodegenHelper<'c, 'tcx>,
+        helper: TerminatorCodegenHelper<'b, 'tcx>,
         mut bx: Bx,
         discr: &mir::Operand<'tcx>,
         switch_ty: Ty<'tcx>,
@@ -316,9 +316,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
     }
 
 
-    fn codegen_drop_terminator<'c>(
+    fn codegen_drop_terminator<'b>(
         &mut self,
-        helper: TerminatorCodegenHelper<'c, 'tcx>,
+        helper: TerminatorCodegenHelper<'b, 'tcx>,
         mut bx: Bx,
         location: &mir::Place<'tcx>,
         target: mir::BasicBlock,
@@ -367,9 +367,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                        unwind);
     }
 
-    fn codegen_assert_terminator<'c>(
+    fn codegen_assert_terminator<'b>(
         &mut self,
-        helper: TerminatorCodegenHelper<'c, 'tcx>,
+        helper: TerminatorCodegenHelper<'b, 'tcx>,
         mut bx: Bx,
         terminator: &mir::Terminator<'tcx>,
         cond: &mir::Operand<'tcx>,
@@ -446,9 +446,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         helper.do_call(self, &mut bx, fn_abi, llfn, &args, None, cleanup);
     }
 
-    fn codegen_call_terminator<'c>(
+    fn codegen_call_terminator<'b>(
         &mut self,
-        helper: TerminatorCodegenHelper<'c, 'tcx>,
+        helper: TerminatorCodegenHelper<'b, 'tcx>,
         mut bx: Bx,
         terminator: &mir::Terminator<'tcx>,
         func: &mir::Operand<'tcx>,
@@ -581,7 +581,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         // Prepare the return value destination
         let ret_dest = if let Some((ref dest, _)) = *destination {
             let is_intrinsic = intrinsic.is_some();
-            self.make_return_dest(&mut bx, dest, &fn_abi.ret, &mut llargs, is_intrinsic)
+            self.make_return_dest(&mut bx, dest, &fn_abi.ret, &mut llargs,
+                                  is_intrinsic)
         } else {
             ReturnDest::Nothing
         };
@@ -805,7 +806,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         &mut self,
         mut bx: Bx,
         bb: mir::BasicBlock,
-        terminator: &mir::Terminator<'tcx>,
+        terminator: &mir::Terminator<'tcx>
     ) {
         debug!("codegen_terminator: {:?}", terminator);
 
@@ -834,7 +835,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
             mir::TerminatorKind::SwitchInt {
                 ref discr, switch_ty, ref values, ref targets
             } => {
-                self.codegen_switchint_terminator(helper, bx, discr, switch_ty, values, targets);
+                self.codegen_switchint_terminator(helper, bx, discr, switch_ty,
+                                                  values, targets);
             }
 
             mir::TerminatorKind::Return => {
@@ -1034,7 +1036,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
     /// No-op in MSVC SEH scheme.
     fn landing_pad_to(
         &mut self,
-        target_bb: mir::BasicBlock,
+        target_bb: mir::BasicBlock
     ) -> Bx::BasicBlock {
         if let Some(block) = self.landing_pads[target_bb] {
             return block;
@@ -1103,7 +1105,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         bx: &mut Bx,
         dest: &mir::Place<'tcx>,
         fn_ret: &ArgAbi<'tcx, Ty<'tcx>>,
-        llargs: &mut Vec<Bx::Value>, is_intrinsic: bool,
+        llargs: &mut Vec<Bx::Value>, is_intrinsic: bool
     ) -> ReturnDest<'tcx, Bx::Value> {
         // If the return is ignored, we can just return a do-nothing `ReturnDest`.
         if fn_ret.is_ignore() {
diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs
index 43c2d27449f..9549749f512 100644
--- a/src/librustc_codegen_ssa/mir/mod.rs
+++ b/src/librustc_codegen_ssa/mir/mod.rs
@@ -323,13 +323,14 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
     fx: &FunctionCx<'a, 'tcx, Bx>,
     memory_locals: &BitSet<mir::Local>,
 ) -> Vec<LocalRef<'tcx, Bx::Value>> {
+    let mir = fx.mir;
     let mut idx = 0;
     let mut llarg_idx = fx.fn_abi.ret.is_indirect() as usize;
 
-    fx.mir.args_iter().enumerate().map(|(arg_index, local)| {
-        let arg_decl = &fx.mir.local_decls[local];
+    mir.args_iter().enumerate().map(|(arg_index, local)| {
+        let arg_decl = &mir.local_decls[local];
 
-        if Some(local) == fx.mir.spread_arg {
+        if Some(local) == mir.spread_arg {
             // This argument (e.g., the last argument in the "rust-call" ABI)
             // is a tuple that was spread at the ABI level and now we have
             // to reconstruct it into a tuple local variable, from multiple
diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs
index 680c5b873b0..fb5fc561b08 100644
--- a/src/librustc_codegen_ssa/mir/rvalue.rs
+++ b/src/librustc_codegen_ssa/mir/rvalue.rs
@@ -696,11 +696,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
 }
 
 impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
-    pub fn rvalue_creates_operand(
-        &self,
-        rvalue: &mir::Rvalue<'tcx>,
-        span: Span,
-    ) -> bool {
+    pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Span) -> bool {
         match *rvalue {
             mir::Rvalue::Ref(..) |
             mir::Rvalue::Len(..) |
diff --git a/src/librustc_data_structures/graph/reference.rs b/src/librustc_data_structures/graph/reference.rs
index eab217692d0..9442bb3cdec 100644
--- a/src/librustc_data_structures/graph/reference.rs
+++ b/src/librustc_data_structures/graph/reference.rs
@@ -21,6 +21,7 @@ impl<'graph, G: WithSuccessors> WithSuccessors for &'graph G {
         (**self).successors(node)
     }
 }
+
 impl<'graph, G: WithPredecessors> WithPredecessors for &'graph G {
     fn predecessors(&self,
                     node: Self::Node)