@@ -213,7 +213,47 @@ impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
213
213
write ! ( f, "{:x}: {}" , s, self . layout. ty)
214
214
}
215
215
Immediate :: ScalarPair ( a, b) => {
216
- // FIXME(oli-obk): at least print tuples and slices nicely
216
+ // Try to print tuples and slices nicely first
217
+ // It's *only* printed for internal debugging
218
+ if let Some ( ty) = tcx. lift ( self . layout . ty ) {
219
+ match ty. kind ( ) {
220
+ ty:: Tuple ( tys) => {
221
+ // For tuples, print each field with its proper type
222
+ if tys. len ( ) == 2 {
223
+ let a_str =
224
+ FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
225
+ p ( cx, a, tys[ 0 ] )
226
+ } ) ?;
227
+ let b_str =
228
+ FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
229
+ p ( cx, b, tys[ 1 ] )
230
+ } ) ?;
231
+
232
+ write ! ( f, "({}, {}): {}" , a_str, b_str, ty) ?;
233
+ return Ok ( ( ) ) ;
234
+ }
235
+ }
236
+ ty:: Slice ( element_ty) => {
237
+ // For slices, the first scalar is the pointer, second is the length
238
+ let ptr_str =
239
+ FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
240
+ p ( cx, a, Ty :: new_ptr ( tcx, * element_ty, ty:: Mutability :: Not ) )
241
+ } ) ?;
242
+ let len_str =
243
+ FmtPrinter :: print_string ( tcx, Namespace :: ValueNS , |cx| {
244
+ p ( cx, b, tcx. types . usize )
245
+ } ) ?;
246
+
247
+ write ! ( f, "&[{}; {}]: {}" , ptr_str, len_str, ty) ?;
248
+ return Ok ( ( ) ) ;
249
+ }
250
+ _ => {
251
+ // For other types, try to print each component with the field types
252
+ // Since we can't easily get field types, fall back to the original format for now
253
+ }
254
+ }
255
+ }
256
+ // Fallback to the original format if we can't pretty print
217
257
write ! ( f, "({:x}, {:x}): {}" , a, b, self . layout. ty)
218
258
}
219
259
Immediate :: Uninit => {
0 commit comments