@@ -213,7 +213,23 @@ impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
213213 write ! ( f, "{:x}: {}" , s, self . layout. ty)
214214 }
215215 Immediate :: ScalarPair ( a, b) => {
216- // FIXME(oli-obk): at least print tuples and slices nicely
216+ // Try to print slices nicely first
217+ // It's *only* printed for internal debugging
218+ if let Some ( ty) = tcx. lift ( self . layout . ty )
219+ && let ty:: Slice ( element_ty) = ty. kind ( )
220+ {
221+ // For slices, the first scalar is the pointer, second is the length
222+ let ptr_str = FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
223+ p ( cx, a, Ty :: new_ptr ( tcx, * element_ty, ty:: Mutability :: Not ) )
224+ } ) ?;
225+ let len_str = FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
226+ p ( cx, b, tcx. types . usize )
227+ } ) ?;
228+
229+ write ! ( f, "&[{}; {}]: {}" , ptr_str, len_str, ty) ?;
230+ return Ok ( ( ) ) ;
231+ }
232+ // Fallback to the original format if we can't pretty print
217233 write ! ( f, "({:x}, {:x}): {}" , a, b, self . layout. ty)
218234 }
219235 Immediate :: Uninit => {
0 commit comments