Skip to content

Commit c42bdb8

Browse files
committed
Undo minor changes that weren't needed, fix one lifetime typo
1 parent e54c610 commit c42bdb8

File tree

5 files changed

+31
-30
lines changed

5 files changed

+31
-30
lines changed

src/librustc_codegen_ssa/mir/analyze.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ use super::FunctionCx;
1717
use crate::traits::*;
1818

1919
pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
20-
fx: &FunctionCx<'a, 'tcx, Bx>
20+
fx: &FunctionCx<'a, 'tcx, Bx>,
2121
) -> BitSet<mir::Local> {
22+
let mir = fx.mir;
2223
let mut analyzer = LocalAnalyzer::new(fx);
2324

24-
analyzer.visit_body(fx.mir);
25+
analyzer.visit_body(mir);
2526

26-
for (local, decl) in fx.mir.local_decls.iter_enumerated()
27+
for (local, decl) in mir.local_decls.iter_enumerated()
2728
{
2829
// FIXME(eddyb): We should figure out how to use llvm.dbg.value instead
2930
// 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>> {
6566
first_assignment: IndexVec<mir::Local, Location>,
6667
}
6768

68-
impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
69+
impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
6970
fn new(fx: &'mir FunctionCx<'a, 'tcx, Bx>) -> Self {
7071
let invalid_location =
7172
mir::BasicBlock::new(fx.mir.basic_blocks().len()).start_location();

src/librustc_codegen_ssa/mir/block.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
4646
fn lltarget<'b, 'c, Bx: BuilderMethods<'b, 'tcx>>(
4747
&self,
4848
fx: &'c mut FunctionCx<'b, 'tcx, Bx>,
49-
target: mir::BasicBlock
49+
target: mir::BasicBlock,
5050
) -> (Bx::BasicBlock, bool) {
5151
let span = self.terminator.source_info.span;
5252
let lltarget = fx.blocks[target];
@@ -66,7 +66,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
6666
fn llblock<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>(
6767
&self,
6868
fx: &'c mut FunctionCx<'b, 'tcx, Bx>,
69-
target: mir::BasicBlock
69+
target: mir::BasicBlock,
7070
) -> Bx::BasicBlock {
7171
let (lltarget, is_cleanupret) = self.lltarget(fx, target);
7272
if is_cleanupret {
@@ -153,7 +153,7 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
153153
// a loop.
154154
fn maybe_sideeffect<'b, 'tcx2: 'b, Bx: BuilderMethods<'b, 'tcx2>>(
155155
&self,
156-
mir: mir::ReadOnlyBodyCache<'_, 'tcx>,
156+
mir: mir::ReadOnlyBodyCache<'b, 'tcx>,
157157
bx: &mut Bx,
158158
targets: &[mir::BasicBlock],
159159
) {
@@ -173,9 +173,9 @@ impl<'a, 'tcx> TerminatorCodegenHelper<'a, 'tcx> {
173173
/// Codegen implementations for some terminator variants.
174174
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
175175
/// Generates code for a `Resume` terminator.
176-
fn codegen_resume_terminator<'c>(
176+
fn codegen_resume_terminator<'b>(
177177
&mut self,
178-
helper: TerminatorCodegenHelper<'c, 'tcx>,
178+
helper: TerminatorCodegenHelper<'b, 'tcx>,
179179
mut bx: Bx,
180180
) {
181181
if let Some(funclet) = helper.funclet(self) {
@@ -201,9 +201,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
201201
}
202202
}
203203

204-
fn codegen_switchint_terminator<'c>(
204+
fn codegen_switchint_terminator<'b>(
205205
&mut self,
206-
helper: TerminatorCodegenHelper<'c, 'tcx>,
206+
helper: TerminatorCodegenHelper<'b, 'tcx>,
207207
mut bx: Bx,
208208
discr: &mir::Operand<'tcx>,
209209
switch_ty: Ty<'tcx>,
@@ -316,9 +316,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
316316
}
317317

318318

319-
fn codegen_drop_terminator<'c>(
319+
fn codegen_drop_terminator<'b>(
320320
&mut self,
321-
helper: TerminatorCodegenHelper<'c, 'tcx>,
321+
helper: TerminatorCodegenHelper<'b, 'tcx>,
322322
mut bx: Bx,
323323
location: &mir::Place<'tcx>,
324324
target: mir::BasicBlock,
@@ -367,9 +367,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
367367
unwind);
368368
}
369369

370-
fn codegen_assert_terminator<'c>(
370+
fn codegen_assert_terminator<'b>(
371371
&mut self,
372-
helper: TerminatorCodegenHelper<'c, 'tcx>,
372+
helper: TerminatorCodegenHelper<'b, 'tcx>,
373373
mut bx: Bx,
374374
terminator: &mir::Terminator<'tcx>,
375375
cond: &mir::Operand<'tcx>,
@@ -446,9 +446,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
446446
helper.do_call(self, &mut bx, fn_abi, llfn, &args, None, cleanup);
447447
}
448448

449-
fn codegen_call_terminator<'c>(
449+
fn codegen_call_terminator<'b>(
450450
&mut self,
451-
helper: TerminatorCodegenHelper<'c, 'tcx>,
451+
helper: TerminatorCodegenHelper<'b, 'tcx>,
452452
mut bx: Bx,
453453
terminator: &mir::Terminator<'tcx>,
454454
func: &mir::Operand<'tcx>,
@@ -581,7 +581,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
581581
// Prepare the return value destination
582582
let ret_dest = if let Some((ref dest, _)) = *destination {
583583
let is_intrinsic = intrinsic.is_some();
584-
self.make_return_dest(&mut bx, dest, &fn_abi.ret, &mut llargs, is_intrinsic)
584+
self.make_return_dest(&mut bx, dest, &fn_abi.ret, &mut llargs,
585+
is_intrinsic)
585586
} else {
586587
ReturnDest::Nothing
587588
};
@@ -805,7 +806,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
805806
&mut self,
806807
mut bx: Bx,
807808
bb: mir::BasicBlock,
808-
terminator: &mir::Terminator<'tcx>,
809+
terminator: &mir::Terminator<'tcx>
809810
) {
810811
debug!("codegen_terminator: {:?}", terminator);
811812

@@ -834,7 +835,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
834835
mir::TerminatorKind::SwitchInt {
835836
ref discr, switch_ty, ref values, ref targets
836837
} => {
837-
self.codegen_switchint_terminator(helper, bx, discr, switch_ty, values, targets);
838+
self.codegen_switchint_terminator(helper, bx, discr, switch_ty,
839+
values, targets);
838840
}
839841

840842
mir::TerminatorKind::Return => {
@@ -1034,7 +1036,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10341036
/// No-op in MSVC SEH scheme.
10351037
fn landing_pad_to(
10361038
&mut self,
1037-
target_bb: mir::BasicBlock,
1039+
target_bb: mir::BasicBlock
10381040
) -> Bx::BasicBlock {
10391041
if let Some(block) = self.landing_pads[target_bb] {
10401042
return block;
@@ -1103,7 +1105,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11031105
bx: &mut Bx,
11041106
dest: &mir::Place<'tcx>,
11051107
fn_ret: &ArgAbi<'tcx, Ty<'tcx>>,
1106-
llargs: &mut Vec<Bx::Value>, is_intrinsic: bool,
1108+
llargs: &mut Vec<Bx::Value>, is_intrinsic: bool
11071109
) -> ReturnDest<'tcx, Bx::Value> {
11081110
// If the return is ignored, we can just return a do-nothing `ReturnDest`.
11091111
if fn_ret.is_ignore() {

src/librustc_codegen_ssa/mir/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,14 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
323323
fx: &FunctionCx<'a, 'tcx, Bx>,
324324
memory_locals: &BitSet<mir::Local>,
325325
) -> Vec<LocalRef<'tcx, Bx::Value>> {
326+
let mir = fx.mir;
326327
let mut idx = 0;
327328
let mut llarg_idx = fx.fn_abi.ret.is_indirect() as usize;
328329

329-
fx.mir.args_iter().enumerate().map(|(arg_index, local)| {
330-
let arg_decl = &fx.mir.local_decls[local];
330+
mir.args_iter().enumerate().map(|(arg_index, local)| {
331+
let arg_decl = &mir.local_decls[local];
331332

332-
if Some(local) == fx.mir.spread_arg {
333+
if Some(local) == mir.spread_arg {
333334
// This argument (e.g., the last argument in the "rust-call" ABI)
334335
// is a tuple that was spread at the ABI level and now we have
335336
// to reconstruct it into a tuple local variable, from multiple

src/librustc_codegen_ssa/mir/rvalue.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -696,11 +696,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
696696
}
697697

698698
impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
699-
pub fn rvalue_creates_operand(
700-
&self,
701-
rvalue: &mir::Rvalue<'tcx>,
702-
span: Span,
703-
) -> bool {
699+
pub fn rvalue_creates_operand(&self, rvalue: &mir::Rvalue<'tcx>, span: Span) -> bool {
704700
match *rvalue {
705701
mir::Rvalue::Ref(..) |
706702
mir::Rvalue::Len(..) |

src/librustc_data_structures/graph/reference.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl<'graph, G: WithSuccessors> WithSuccessors for &'graph G {
2121
(**self).successors(node)
2222
}
2323
}
24+
2425
impl<'graph, G: WithPredecessors> WithPredecessors for &'graph G {
2526
fn predecessors(&self,
2627
node: Self::Node)

0 commit comments

Comments
 (0)