Skip to content

Commit

Permalink
Added some debug logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtwco committed Aug 7, 2018
1 parent 11a9024 commit efda9f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/librustc_mir/borrow_check/move_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
| GroupedMoveError::OtherIllegalMove { span, ref kind } => (span, kind),
};
let origin = Origin::Mir;
debug!("report: span={:?}, kind={:?}", span, kind);
(
match kind {
IllegalMoveOriginKind::Static => {
Expand Down Expand Up @@ -262,6 +263,10 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
}
None => bug!("closure kind not inferred by borrowck"),
};
debug!("report: closure_kind_ty={:?} closure_kind={:?} \
place_description={:?}", closure_kind_ty, closure_kind,
place_description);

self.tcx.cannot_move_out_of(span, place_description, origin)
}
_ => self
Expand Down
12 changes: 12 additions & 0 deletions src/librustc_mir/borrow_check/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
error_access: AccessKind,
location: Location,
) {
debug!(
"report_mutability_error(\
access_place={:?}, span={:?}, the_place_err={:?}, error_access={:?}, location={:?},\
)",
access_place, span, the_place_err, error_access, location,
);

let mut err;
let item_msg;
let reason;
let access_place_desc = self.describe_place(access_place);
debug!("report_mutability_error: access_place_desc={:?}", access_place_desc);

match the_place_err {
Place::Local(local) => {
Expand Down Expand Up @@ -155,6 +163,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
}) => bug!("Unexpected immutable place."),
}

debug!("report_mutability_error: item_msg={:?}, reason={:?}", item_msg, reason);

// `act` and `acted_on` are strings that let us abstract over
// the verbs used in some diagnostic messages.
let act;
Expand Down Expand Up @@ -199,6 +209,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
}
};

debug!("report_mutability_error: act={:?}, acted_on={:?}", act, acted_on);

match the_place_err {
// We want to suggest users use `let mut` for local (user
// variable) mutations...
Expand Down

0 comments on commit efda9f8

Please sign in to comment.