use rustc::hir::*;
use rustc::hir::map::Node::*;
-struct GatherMoveInfo<'tcx> {
+struct GatherMoveInfo<'c, 'tcx: 'c> {
id: hir::ItemLocalId,
kind: MoveKind,
- cmt: mc::cmt<'tcx>,
+ cmt: &'c mc::cmt_<'tcx>,
span_path_opt: Option<MovePlace<'tcx>>
}
move_data: &MoveData<'tcx>,
move_error_collector: &mut MoveErrorCollector<'tcx>,
move_expr_id: hir::ItemLocalId,
- cmt: mc::cmt<'tcx>,
+ cmt: &mc::cmt_<'tcx>,
move_reason: euv::MoveReason) {
let kind = match move_reason {
euv::DirectRefMove | euv::PatBindingMove => MoveExpr,
gather_move(bccx, move_data, move_error_collector, move_info);
}
-pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
- move_data: &MoveData<'tcx>,
- move_error_collector: &mut MoveErrorCollector<'tcx>,
- move_pat: &hir::Pat,
- cmt: mc::cmt<'tcx>) {
+pub fn gather_move_from_pat<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>,
+ move_data: &MoveData<'tcx>,
+ move_error_collector: &mut MoveErrorCollector<'tcx>,
+ move_pat: &hir::Pat,
+ cmt: &'c mc::cmt_<'tcx>) {
let source = get_pattern_source(bccx.tcx,move_pat);
let pat_span_path_opt = match move_pat.node {
PatKind::Binding(_, _, ref path1, _) => {
gather_move(bccx, move_data, move_error_collector, move_info);
}
-fn gather_move<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
+fn gather_move<'a, 'c, 'tcx: 'c>(bccx: &BorrowckCtxt<'a, 'tcx>,
move_data: &MoveData<'tcx>,
move_error_collector: &mut MoveErrorCollector<'tcx>,
- move_info: GatherMoveInfo<'tcx>) {
+ move_info: GatherMoveInfo<'c, 'tcx>) {
debug!("gather_move(move_id={:?}, cmt={:?})",
move_info.id, move_info.cmt);
- let potentially_illegal_move =
- check_and_get_illegal_move_origin(bccx, &move_info.cmt);
+ let potentially_illegal_move = check_and_get_illegal_move_origin(bccx, move_info.cmt);
if let Some(illegal_move_origin) = potentially_illegal_move {
debug!("illegal_move_origin={:?}", illegal_move_origin);
- let error = MoveError::with_move_info(illegal_move_origin,
+ let error = MoveError::with_move_info(Rc::new(illegal_move_origin),
move_info.span_path_opt);
move_error_collector.add_error(error);
return;
// (keep in sync with move_error::report_cannot_move_out_of )
fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
- cmt: &mc::cmt<'tcx>)
- -> Option<mc::cmt<'tcx>> {
+ cmt: &mc::cmt_<'tcx>)
+ -> Option<mc::cmt_<'tcx>> {
match cmt.cat {
Categorization::Deref(_, mc::BorrowedPtr(..)) |
Categorization::Deref(_, mc::UnsafePtr(..)) |