From: Niko Matsakis Date: Wed, 23 Mar 2016 09:57:52 +0000 (-0400) Subject: Update borrowck to use `repr::*` instead of a mix X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=1c0fa3431052e8b6d944891dc20a1dd614bedd13;p=rust.git 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. --- diff --git a/src/librustc_borrowck/borrowck/mir/gather_moves.rs b/src/librustc_borrowck/borrowck/mir/gather_moves.rs index 0c42ac4fd84..46eb3d3ca03 100644 --- a/src/librustc_borrowck/borrowck/mir/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/mir/gather_moves.rs @@ -9,9 +9,8 @@ // except according to those terms. -use rustc::middle::ty; -use rustc::mir::repr::{self, Mir, BasicBlock, Lvalue, Rvalue}; -use rustc::mir::repr::{StatementKind, TerminatorKind}; +use rustc::middle::ty::TyCtxt; +use rustc::mir::repr::*; use rustc::util::nodemap::FnvHashMap; use std::cell::{Cell}; @@ -361,7 +360,7 @@ fn lookup_return_pointer(&mut self) -> Lookup { } fn lookup_proj(&mut self, - proj: &repr::LvalueProjection<'tcx>, + proj: &LvalueProjection<'tcx>, base: MovePathIndex) -> Lookup { let MovePathLookup { ref mut projections, ref mut next_index, .. } = *self; @@ -484,7 +483,7 @@ fn move_path_for(&mut self, lval: &Lvalue<'tcx>) -> MovePathIndex { } impl<'tcx> MoveData<'tcx> { - pub fn gather_moves(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> Self { + pub fn gather_moves(mir: &Mir<'tcx>, tcx: &TyCtxt<'tcx>) -> Self { gather_moves(mir, tcx) } } @@ -495,7 +494,7 @@ enum StmtKind { Aggregate, Drop, CallFn, CallArg, Return, } -fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx> { +fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &TyCtxt<'tcx>) -> MoveData<'tcx> { use self::StmtKind as SK; let bbs = mir.all_basic_blocks(); @@ -554,9 +553,9 @@ fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx> Rvalue::Box(ref _ty) => { // this is creating uninitialized // memory that needs to be initialized. - let deref_lval = Lvalue::Projection(Box::new( repr::Projection { + let deref_lval = Lvalue::Projection(Box::new(Projection { base: lval.clone(), - elem: repr::ProjectionElem::Deref, + elem: ProjectionElem::Deref, })); bb_ctxt.on_move_out_lval(SK::Box, &deref_lval, source); } @@ -668,7 +667,7 @@ fn gather_moves<'tcx>(mir: &Mir<'tcx>, tcx: &ty::TyCtxt<'tcx>) -> MoveData<'tcx> } struct BlockContext<'b, 'a: 'b, 'tcx: 'a> { - tcx: &'b ty::TyCtxt<'tcx>, + tcx: &'b TyCtxt<'tcx>, moves: &'b mut Vec, builder: MovePathDataBuilder<'a, 'tcx>, path_map: &'b mut Vec>, @@ -678,7 +677,7 @@ struct BlockContext<'b, 'a: 'b, 'tcx: 'a> { impl<'b, 'a: 'b, 'tcx: 'a> BlockContext<'b, 'a, 'tcx> { fn on_move_out_lval(&mut self, stmt_kind: StmtKind, - lval: &repr::Lvalue<'tcx>, + lval: &Lvalue<'tcx>, source: Location) { let tcx = self.tcx; let lval_ty = self.builder.mir.lvalue_ty(tcx, lval); @@ -724,10 +723,10 @@ fn on_move_out_lval(&mut self, self.loc_map_bb[i].push(index); } - fn on_operand(&mut self, stmt_kind: StmtKind, operand: &repr::Operand<'tcx>, source: Location) { + fn on_operand(&mut self, stmt_kind: StmtKind, operand: &Operand<'tcx>, source: Location) { match *operand { - repr::Operand::Constant(..) => {} // not-a-move - repr::Operand::Consume(ref lval) => { // a move + Operand::Constant(..) => {} // not-a-move + Operand::Consume(ref lval) => { // a move self.on_move_out_lval(stmt_kind, lval, source); } }