From efda9f80f047a2b657a9cc2100fcd208bc056557 Mon Sep 17 00:00:00 2001 From: David Wood Date: Tue, 7 Aug 2018 15:37:32 +0200 Subject: [PATCH] Added some debug logging. --- src/librustc_mir/borrow_check/move_errors.rs | 5 +++++ src/librustc_mir/borrow_check/mutability_errors.rs | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index 4d988fef450b8..86bbec795b0f4 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -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 => { @@ -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 diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index e8862320ddf3f..25428d2c4241f 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -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) => { @@ -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; @@ -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...