-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
rust/src/librustc_mir/borrow_check.rs
Lines 79 to 102 in 88a28ff
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
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.