@@ -7,7 +7,8 @@ use rustc_hir::def_id::DefId;
7
7
use rustc_middle:: mir:: interpret:: { ErrorHandled , InvalidMetaKind , ReportedErrorInfo } ;
8
8
use rustc_middle:: query:: TyCtxtAt ;
9
9
use rustc_middle:: ty:: layout:: {
10
- self , FnAbiError , FnAbiOfHelpers , FnAbiRequest , LayoutError , LayoutOfHelpers , TyAndLayout ,
10
+ self , FnAbiError , FnAbiOfHelpers , FnAbiRequest , LayoutError , LayoutOf , LayoutOfHelpers ,
11
+ TyAndLayout ,
11
12
} ;
12
13
use rustc_middle:: ty:: { self , GenericArgsRef , Ty , TyCtxt , TypeFoldable , TypingEnv , Variance } ;
13
14
use rustc_middle:: { mir, span_bug} ;
@@ -91,6 +92,20 @@ impl<'tcx, M: Machine<'tcx>> LayoutOfHelpers<'tcx> for InterpCx<'tcx, M> {
91
92
}
92
93
}
93
94
95
+ impl < ' tcx , M : Machine < ' tcx > > InterpCx < ' tcx , M > {
96
+ /// This inherent method takes priority over the trait method with the same name in LayoutOf,
97
+ /// and allows wrapping the actual [LayoutOf::layout_of] with a tracing span.
98
+ /// See [LayoutOf::layout_of] for the original documentation.
99
+ #[ inline]
100
+ pub fn layout_of (
101
+ & self ,
102
+ ty : Ty < ' tcx > ,
103
+ ) -> <InterpCx < ' tcx , M > as LayoutOfHelpers < ' tcx > >:: LayoutOfResult {
104
+ let _span = enter_trace_span ! ( M , "InterpCx::layout_of" , "ty = {:?}" , ty. kind( ) ) ;
105
+ LayoutOf :: layout_of ( self , ty)
106
+ }
107
+ }
108
+
94
109
impl < ' tcx , M : Machine < ' tcx > > FnAbiOfHelpers < ' tcx > for InterpCx < ' tcx , M > {
95
110
type FnAbiOfResult = Result < & ' tcx FnAbi < ' tcx , Ty < ' tcx > > , InterpErrorKind < ' tcx > > ;
96
111
0 commit comments