};
}
-fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> {
+fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> {
let input_body = tcx.mir_validated(def_id);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id));
opt_closure_req
}
-fn do_mir_borrowck<'a, 'gcx, 'tcx>(
- infcx: &InferCtxt<'a, 'gcx, 'tcx>,
- input_body: &Body<'gcx>,
+fn do_mir_borrowck<'a, 'tcx>(
+ infcx: &InferCtxt<'a, 'tcx>,
+ input_body: &Body<'tcx>,
def_id: DefId,
-) -> BorrowCheckResult<'gcx> {
+) -> BorrowCheckResult<'tcx> {
debug!("do_mir_borrowck(def_id = {:?})", def_id);
let tcx = infcx.tcx;
}
}
-pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
- infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>,
+pub struct MirBorrowckCtxt<'cx, 'tcx: 'cx> {
+ infcx: &'cx InferCtxt<'cx, 'tcx>,
body: &'cx Body<'tcx>,
mir_def_id: DefId,
move_data: &'cx MoveData<'tcx>,
// 2. loans made in overlapping scopes do not conflict
// 3. assignments do not affect things loaned out as immutable
// 4. moves do not affect things loaned out in any way
-impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
- type FlowState = Flows<'cx, 'gcx, 'tcx>;
+impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx> {
+ type FlowState = Flows<'cx, 'tcx>;
fn body(&self) -> &'cx Body<'tcx> {
self.body
// "Lift" into the gcx -- once regions are erased, this type should be in the
// global arenas; this "lift" operation basically just asserts that is true, but
// that is useful later.
- let drop_place_ty = gcx.lift(&drop_place_ty).unwrap();
+ gcx.lift_to_global(&drop_place_ty).unwrap();
debug!("visit_terminator_drop \
loc: {:?} term: {:?} drop_place: {:?} drop_place_ty: {:?} span: {:?}",
}
}
-impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
+impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
/// Checks an access to the given place to see if it is allowed. Examines the set of borrows
/// that are in scope, as well as which paths have been initialized, to ensure that (a) the
/// place is initialized and (b) it is not borrowed in some way that would prevent this
place_span: (&Place<'tcx>, Span),
kind: (AccessDepth, ReadOrWrite),
is_local_mutation_allowed: LocalMutationIsAllowed,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
let (sd, rw) = kind;
place_span: (&Place<'tcx>, Span),
sd: AccessDepth,
rw: ReadOrWrite,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) -> bool {
debug!(
"check_access_for_conflict(location={:?}, place_span={:?}, sd={:?}, rw={:?})",
place_span: (&Place<'tcx>, Span),
kind: AccessDepth,
mode: MutateMode,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
// Write of P[i] or *P, or WriteAndRead of any P, requires P init'd.
match mode {
&mut self,
location: Location,
(rvalue, span): (&Rvalue<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
match *rvalue {
Rvalue::Ref(_ /*rgn*/, bk, ref place) => {
&mut self,
location: Location,
(operand, span): (&Operand<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
match *operand {
Operand::Copy(ref place) => {
}
}
- fn check_activations(
- &mut self,
- location: Location,
- span: Span,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
- ) {
+ fn check_activations(&mut self, location: Location, span: Span, flow_state: &Flows<'cx, 'tcx>) {
// Two-phase borrow support: For each activation that is newly
// generated at this statement, check if it interferes with
// another borrow.
}
}
-impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
+impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
fn check_if_reassignment_to_immutable_state(
&mut self,
location: Location,
local: Local,
place_span: (&Place<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
debug!("check_if_reassignment_to_immutable_state({:?})", local);
location: Location,
desired_action: InitializationRequiringAction,
place_span: (&Place<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
let maybe_uninits = &flow_state.uninits;
location: Location,
desired_action: InitializationRequiringAction,
place_span: (&Place<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
let maybe_uninits = &flow_state.uninits;
&mut self,
location: Location,
(place, span): (&Place<'tcx>, Span),
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
debug!("check_if_assigned_path_is_moved place: {:?}", place);
// recur down place; dispatch to external checks when necessary
}
}
- fn check_parent_of_field<'cx, 'gcx, 'tcx>(
- this: &mut MirBorrowckCtxt<'cx, 'gcx, 'tcx>,
+ fn check_parent_of_field<'cx, 'tcx>(
+ this: &mut MirBorrowckCtxt<'cx, 'tcx>,
location: Location,
base: &Place<'tcx>,
span: Span,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
) {
// rust-lang/rust#21232: Until Rust allows reads from the
// initialized parts of partially initialized structs, we
(place, span): (&Place<'tcx>, Span),
kind: ReadOrWrite,
is_local_mutation_allowed: LocalMutationIsAllowed,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
+ flow_state: &Flows<'cx, 'tcx>,
location: Location,
) -> bool {
debug!(
};
}
- fn is_local_ever_initialized(&self,
- local: Local,
- flow_state: &Flows<'cx, 'gcx, 'tcx>)
- -> Option<InitIndex>
- {
+ fn is_local_ever_initialized(
+ &self,
+ local: Local,
+ flow_state: &Flows<'cx, 'tcx>,
+ ) -> Option<InitIndex> {
let mpi = self.move_data.rev_lookup.find_local(local);
let ii = &self.move_data.init_path_map[mpi];
for &index in ii {
}
/// Adds the place into the used mutable variables set
- fn add_used_mut<'d>(
- &mut self,
- root_place: RootPlace<'d, 'tcx>,
- flow_state: &Flows<'cx, 'gcx, 'tcx>,
- ) {
+ fn add_used_mut<'d>(&mut self, root_place: RootPlace<'d, 'tcx>, flow_state: &Flows<'cx, 'tcx>) {
match root_place {
RootPlace {
place: Place::Base(PlaceBase::Local(local)),