From d654e3c69b127f274c6ef146bc27901086a1cd28 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Sat, 29 Sep 2018 08:04:34 +0200 Subject: [PATCH] Improve bug! message for impossible case in Relate Hitting this branch in Clippy and I think it makes sense to print both values here in case other people hit this branch, too. --- src/librustc/ty/relate.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 98042e18d32d9..547f7cecc4e06 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -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) + } } } }