Rollup merge of #54679 - phansch:improve_bug_message, r=matthewjasper

Improve bug! message for impossible case in Relate

Hitting this branch [in Clippy][clippy_issue] and I think it makes sense to print
both values here in case other people hit this branch, too.

(still have to figure out why this branch is hit)

[clippy_issue]: https://github.com/rust-lang-nursery/rust-clippy/issues/2831#issuecomment-424597092
This commit is contained in:
kennytm 2018-10-01 16:13:03 +08:00 committed by GitHub
commit 23a993c8c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -702,7 +702,12 @@ impl<'tcx> Relate<'tcx> for Kind<'tcx> {
(UnpackedKind::Type(a_ty), UnpackedKind::Type(b_ty)) => {
Ok(relation.relate(&a_ty, &b_ty)?.into())
}
(UnpackedKind::Lifetime(_), _) | (UnpackedKind::Type(_), _) => bug!()
(UnpackedKind::Lifetime(unpacked), x) => {
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
}
(UnpackedKind::Type(unpacked), x) => {
bug!("impossible case reached: can't relate: {:?} with {:?}", unpacked, x)
}
}
}
}