Skip to content

Commit 1c0fa34

Browse files
committed
Update borrowck to use repr::* instead of a mix
We should probably settle on some conventions here. In MIR code, I have generally been importing `*`, but perhaps borrowck does not want to do that.
1 parent 2b96cfb commit 1c0fa34

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/librustc_borrowck/borrowck/mir/gather_moves.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
// except according to those terms.
1010

1111

12-
use rustc::middle::ty;
13-
use rustc::mir::repr::{self, Mir, BasicBlock, Lvalue, Rvalue};
14-
use rustc::mir::repr::{StatementKind, TerminatorKind};
12+
use rustc::middle::ty::TyCtxt;
13+
use rustc::mir::repr::*;
1514
use rustc::util::nodemap::FnvHashMap;
1615

1716
use std::cell::{Cell};
@@ -361,7 +360,7 @@ impl<'tcx> MovePathLookup<'tcx> {
361360
}
362361

363362
fn lookup_proj(&mut self,
364-
proj: &repr::LvalueProjection<'tcx>,
363+
proj: &LvalueProjection<'tcx>,
365364
base: MovePathIndex) -> Lookup<MovePathIndex> {
366365
let MovePathLookup { ref mut projections,
367366
ref mut next_index, .. } = *self;
@@ -484,7 +483,7 @@ impl<'a, 'tcx> MovePathDataBuilder<'a, 'tcx> {
484483
}
485484

486485
impl<'tcx> MoveData<'tcx> {
487-
pub fn gather_moves(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> Self {
486+
pub fn gather_moves(mir: &Mir<'tcx>, tcx: &TyCtxt<'tcx>) -> Self {
488487
gather_moves(mir, tcx)
489488
}
490489
}
@@ -495,7 +494,7 @@ enum StmtKind {
495494
Aggregate, Drop, CallFn, CallArg, Return,
496495
}
497496

498-
fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx> {
497+
fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &TyCtxt<'tcx>) -> MoveData<'tcx> {
499498
use self::StmtKind as SK;
500499

501500
let bbs = mir.all_basic_blocks();
@@ -554,9 +553,9 @@ fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx>
554553
Rvalue::Box(ref _ty) => {
555554
// this is creating uninitialized
556555
// memory that needs to be initialized.
557-
let deref_lval = Lvalue::Projection(Box::new( repr::Projection {
556+
let deref_lval = Lvalue::Projection(Box::new(Projection {
558557
base: lval.clone(),
559-
elem: repr::ProjectionElem::Deref,
558+
elem: ProjectionElem::Deref,
560559
}));
561560
bb_ctxt.on_move_out_lval(SK::Box, &deref_lval, source);
562561
}
@@ -668,7 +667,7 @@ fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx>
668667
}
669668

670669
struct BlockContext<'b, 'a: 'b, 'tcx: 'a> {
671-
tcx: &'b ty::TyCtxt<'tcx>,
670+
tcx: &'b TyCtxt<'tcx>,
672671
moves: &'b mut Vec<MoveOut>,
673672
builder: MovePathDataBuilder<'a, 'tcx>,
674673
path_map: &'b mut Vec<Vec<MoveOutIndex>>,
@@ -678,7 +677,7 @@ struct BlockContext<'b, 'a: 'b, 'tcx: 'a> {
678677
impl<'b, 'a: 'b, 'tcx: 'a> BlockContext<'b, 'a, 'tcx> {
679678
fn on_move_out_lval(&mut self,
680679
stmt_kind: StmtKind,
681-
lval: &repr::Lvalue<'tcx>,
680+
lval: &Lvalue<'tcx>,
682681
source: Location) {
683682
let tcx = self.tcx;
684683
let lval_ty = self.builder.mir.lvalue_ty(tcx, lval);
@@ -724,10 +723,10 @@ impl<'b, 'a: 'b, 'tcx: 'a> BlockContext<'b, 'a, 'tcx> {
724723
self.loc_map_bb[i].push(index);
725724
}
726725

727-
fn on_operand(&mut self, stmt_kind: StmtKind, operand: &repr::Operand<'tcx>, source: Location) {
726+
fn on_operand(&mut self, stmt_kind: StmtKind, operand: &Operand<'tcx>, source: Location) {
728727
match *operand {
729-
repr::Operand::Constant(..) => {} // not-a-move
730-
repr::Operand::Consume(ref lval) => { // a move
728+
Operand::Constant(..) => {} // not-a-move
729+
Operand::Consume(ref lval) => { // a move
731730
self.on_move_out_lval(stmt_kind, lval, source);
732731
}
733732
}

0 commit comments

Comments
 (0)