Skip to content

Commit

Permalink
better bug message
Browse files Browse the repository at this point in the history
  • Loading branch information
ouz-a committed Sep 22, 2023
1 parent d6efedc commit 442c87a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compiler/rustc_mir_dataflow/src/move_paths/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
}
ty::Adt(adt, _) => {
if !adt.is_box() {
bug!("Adt should be a box type");
bug!("Adt should be a box type when Place is deref");
}
}
ty::Bool
Expand All @@ -153,7 +153,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
| ty::Bound(_, _)
| ty::Infer(_)
| ty::Error(_)
| ty::Placeholder(_) => bug!("Place has a wrong type {place_ty:#?}"),
| ty::Placeholder(_) => {
bug!("When Place is Deref it's type shouldn't be {place_ty:#?}")
}
},
ProjectionElem::Field(_, _) => match place_ty.kind() {
ty::Adt(adt, _) if adt.has_dtor(tcx) => {
Expand Down Expand Up @@ -190,7 +192,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
| ty::Bound(_, _)
| ty::Infer(_)
| ty::Error(_)
| ty::Placeholder(_) => bug!("Place has a wrong type {place_ty:#?}"),
| ty::Placeholder(_) => bug!(
"When Place contains ProjectionElem::Field it's type shouldn't be {place_ty:#?}"
),
},
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
match place_ty.kind() {
Expand Down

0 comments on commit 442c87a

Please sign in to comment.