|
let move_data: MoveData<'tcx> = match MoveData::gather_moves(input_mir, tcx, param_env) { |
|
Ok(move_data) => move_data, |
|
Err((move_data, move_errors)) => { |
|
for move_error in move_errors { |
|
let (span, kind): (Span, IllegalMoveOriginKind) = match move_error { |
|
MoveError::UnionMove { .. } => |
|
unimplemented!("dont know how to report union move errors yet."), |
|
MoveError::IllegalMove { cannot_move_out_of: o } => (o.span, o.kind), |
|
}; |
|
let origin = Origin::Mir; |
|
let mut err = match kind { |
|
IllegalMoveOriginKind::Static => |
|
tcx.cannot_move_out_of(span, "static item", origin), |
|
IllegalMoveOriginKind::BorrowedContent => |
|
tcx.cannot_move_out_of(span, "borrowed_content", origin), |
|
IllegalMoveOriginKind::InteriorOfTypeWithDestructor { container_ty: ty } => |
|
tcx.cannot_move_out_of_interior_of_drop(span, ty, origin), |
|
IllegalMoveOriginKind::InteriorOfSliceOrArray { ty, is_index } => |
|
tcx.cannot_move_out_of_interior_noncopy(span, ty, is_index, origin), |
|
}; |
|
err.emit(); |
|
} |
|
move_data |
|
} |
This appears e.g. in
struct S;
fn main() {
let a = &mut S;
let b = *a;
}
and also in the test src/test/compile-fail/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
rust/src/librustc_mir/borrow_check.rs
Lines 79 to 102 in 88a28ff
This appears e.g. in
and also in the test src/test/compile-fail/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs