diff options
| author | ouz-a <ouz.agz@gmail.com> | 2023-09-22 16:28:45 +0300 |
|---|---|---|
| committer | ouz-a <ouz.agz@gmail.com> | 2023-09-22 16:28:45 +0300 |
| commit | 63df126f59622f280dd34489eb7b3a03bdd7417d (patch) | |
| tree | f1bc2b1653f55be7800b053a3b3c6421770bebf2 | |
| parent | 442c87a0b0168e644a40ef8ecd874c53fe7e04b8 (diff) | |
| download | rust-63df126f59622f280dd34489eb7b3a03bdd7417d.tar.gz rust-63df126f59622f280dd34489eb7b3a03bdd7417d.zip | |
match array for constantindex and subslice
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/move_paths/builder.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs index 8732489418a..213b81eaac9 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs @@ -158,13 +158,13 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { } }, ProjectionElem::Field(_, _) => match place_ty.kind() { - ty::Adt(adt, _) if adt.has_dtor(tcx) => { - return Err(MoveError::cannot_move_out_of( - self.loc, - InteriorOfTypeWithDestructor { container_ty: place_ty }, - )); - } ty::Adt(adt, _) => { + if adt.has_dtor(tcx) { + return Err(MoveError::cannot_move_out_of( + self.loc, + InteriorOfTypeWithDestructor { container_ty: place_ty }, + )); + } if adt.is_union() { union_path.get_or_insert(base); } @@ -207,7 +207,8 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { }, )); } - _ => (), + ty::Array(_, _) => (), + _ => bug!("Unexpected type {:#?}", place_ty.is_array()), } } ProjectionElem::Index(_) => match place_ty.kind() { @@ -226,7 +227,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { }, )); } - _ => (), + _ => bug!("Unexpected type {place_ty:#?}"), }, // `OpaqueCast` only transmutes the type, so no moves there and // `Downcast` only changes information about a `Place` without moving |
