about summary refs log tree commit diff
diff options
context:
space:
mode:
authorouz-a <ouz.agz@gmail.com>2023-09-22 11:31:14 +0300
committerouz-a <ouz.agz@gmail.com>2023-09-22 11:31:45 +0300
commit442c87a0b0168e644a40ef8ecd874c53fe7e04b8 (patch)
tree17df505631e9030d3750c3ffdfc6cbbb07f7aef0
parentd6efedcaf578e67f07293349d2128c06043a239f (diff)
downloadrust-442c87a0b0168e644a40ef8ecd874c53fe7e04b8.tar.gz
rust-442c87a0b0168e644a40ef8ecd874c53fe7e04b8.zip
better bug message
-rw-r--r--compiler/rustc_mir_dataflow/src/move_paths/builder.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
index d19b1a902f4..8732489418a 100644
--- a/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
+++ b/compiler/rustc_mir_dataflow/src/move_paths/builder.rs
@@ -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
@@ -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) => {
@@ -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() {