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::InteriorOfSlice { elem_ty: ty, is_index } =>
- tcx.cannot_move_out_of_interior_noncopy(span, ty, is_index, origin),
- IllegalMoveOriginKind::InteriorOfArray { elem_ty: ty, is_index } =>
+ IllegalMoveOriginKind::InteriorOfSliceOrArray { ty, is_index } =>
tcx.cannot_move_out_of_interior_noncopy(span, ty, is_index, origin),
};
err.emit();
// move out of union - always move the entire union
ty::TyAdt(adt, _) if adt.is_union() =>
return Err(MoveError::UnionMove { path: base }),
- ty::TySlice(elem_ty) =>
+ ty::TySlice(_) =>
return Err(MoveError::cannot_move_out_of(
mir.source_info(self.loc).span,
- InteriorOfSlice {
- elem_ty, is_index: match proj.elem {
+ InteriorOfSliceOrArray {
+ ty: lv_ty, is_index: match proj.elem {
ProjectionElem::Index(..) => true,
_ => false
},
})),
- ty::TyArray(elem_ty, _num_elems) => match proj.elem {
+ ty::TyArray(..) => match proj.elem {
ProjectionElem::Index(..) =>
return Err(MoveError::cannot_move_out_of(
mir.source_info(self.loc).span,
- InteriorOfArray {
- elem_ty, is_index: true
+ InteriorOfSliceOrArray {
+ ty: lv_ty, is_index: true
})),
_ => {
// FIXME: still badly broken
Static,
BorrowedContent,
InteriorOfTypeWithDestructor { container_ty: ty::Ty<'tcx> },
- InteriorOfSlice { elem_ty: ty::Ty<'tcx>, is_index: bool, },
- InteriorOfArray { elem_ty: ty::Ty<'tcx>, is_index: bool, },
+ InteriorOfSliceOrArray { ty: ty::Ty<'tcx>, is_index: bool, },
}
#[derive(Debug)]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// revisions: ast mir
+//[mir]compile-flags: -Zborrowck-mir
+
struct NonCopy;
fn main() {
let array = [NonCopy; 1];
- let _value = array[0]; //~ ERROR E0508
+ let _value = array[0]; //[ast]~ ERROR E0508
+ //[mir]~^ ERROR (Ast) [E0508]
+ //[mir]~| ERROR (Mir) [E0508]
}