3
3
use gimli:: write:: { AttributeValue , UnitEntryId } ;
4
4
use rustc_codegen_ssa:: debuginfo:: type_names;
5
5
use rustc_data_structures:: fx:: FxHashMap ;
6
+ use rustc_middle:: ty:: layout:: LayoutOf ;
6
7
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
7
8
8
- use crate :: { has_ptr_meta, DebugContext } ;
9
+ use crate :: { has_ptr_meta, DebugContext , RevealAllLayoutCx } ;
9
10
10
11
#[ derive( Default ) ]
11
12
pub ( crate ) struct TypeDebugContext < ' tcx > {
@@ -41,6 +42,7 @@ impl DebugContext {
41
42
ty:: Array ( elem_ty, len) => self . array_type (
42
43
tcx,
43
44
type_dbg,
45
+ ty,
44
46
* elem_ty,
45
47
len. eval_target_usize ( tcx, ty:: ParamEnv :: reveal_all ( ) ) ,
46
48
) ,
@@ -83,9 +85,7 @@ impl DebugContext {
83
85
type_entry. set ( gimli:: DW_AT_encoding , AttributeValue :: Encoding ( encoding) ) ;
84
86
type_entry. set (
85
87
gimli:: DW_AT_byte_size ,
86
- AttributeValue :: Udata (
87
- tcx. layout_of ( ty:: ParamEnv :: reveal_all ( ) . and ( ty) ) . expect ( "FIXME" ) . size . bytes ( ) ,
88
- ) ,
88
+ AttributeValue :: Udata ( RevealAllLayoutCx ( tcx) . layout_of ( ty) . size . bytes ( ) ) ,
89
89
) ;
90
90
91
91
type_id
@@ -95,12 +95,13 @@ impl DebugContext {
95
95
& mut self ,
96
96
tcx : TyCtxt < ' tcx > ,
97
97
type_dbg : & mut TypeDebugContext < ' tcx > ,
98
+ array_ty : Ty < ' tcx > ,
98
99
elem_ty : Ty < ' tcx > ,
99
100
len : u64 ,
100
101
) -> UnitEntryId {
101
102
let elem_dw_ty = self . debug_type ( tcx, type_dbg, elem_ty) ;
102
103
103
- return_if_type_created_in_meantime ! ( type_dbg, elem_ty ) ;
104
+ return_if_type_created_in_meantime ! ( type_dbg, array_ty ) ;
104
105
105
106
let array_type_id = self . dwarf . unit . add ( self . dwarf . unit . root ( ) , gimli:: DW_TAG_array_type ) ;
106
107
let array_type_entry = self . dwarf . unit . get_mut ( array_type_id) ;
@@ -152,11 +153,7 @@ impl DebugContext {
152
153
self . debug_type (
153
154
tcx,
154
155
type_dbg,
155
- Ty :: new_array (
156
- tcx,
157
- tcx. types . u8 ,
158
- tcx. layout_of ( ty:: ParamEnv :: reveal_all ( ) . and ( ty) ) . unwrap ( ) . size . bytes ( ) ,
159
- ) ,
156
+ Ty :: new_array ( tcx, tcx. types . u8 , RevealAllLayoutCx ( tcx) . layout_of ( ty) . size . bytes ( ) ) ,
160
157
)
161
158
}
162
159
}
0 commit comments