Skip to content

Commit 442c87a

Browse files
committed
better bug message
1 parent d6efedc commit 442c87a

File tree

1 file changed

+7
-3
lines changed
  • compiler/rustc_mir_dataflow/src/move_paths

1 file changed

+7
-3
lines changed

compiler/rustc_mir_dataflow/src/move_paths/builder.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
127127
}
128128
ty::Adt(adt, _) => {
129129
if !adt.is_box() {
130-
bug!("Adt should be a box type");
130+
bug!("Adt should be a box type when Place is deref");
131131
}
132132
}
133133
ty::Bool
@@ -153,7 +153,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
153153
| ty::Bound(_, _)
154154
| ty::Infer(_)
155155
| ty::Error(_)
156-
| ty::Placeholder(_) => bug!("Place has a wrong type {place_ty:#?}"),
156+
| ty::Placeholder(_) => {
157+
bug!("When Place is Deref it's type shouldn't be {place_ty:#?}")
158+
}
157159
},
158160
ProjectionElem::Field(_, _) => match place_ty.kind() {
159161
ty::Adt(adt, _) if adt.has_dtor(tcx) => {
@@ -190,7 +192,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
190192
| ty::Bound(_, _)
191193
| ty::Infer(_)
192194
| ty::Error(_)
193-
| ty::Placeholder(_) => bug!("Place has a wrong type {place_ty:#?}"),
195+
| ty::Placeholder(_) => bug!(
196+
"When Place contains ProjectionElem::Field it's type shouldn't be {place_ty:#?}"
197+
),
194198
},
195199
ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => {
196200
match place_ty.kind() {

0 commit comments

Comments
 (0)