@@ -7,8 +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, LayoutOf, LayoutOfHelpers ,
11
- TyAndLayout,
10
+ self, FnAbiError, FnAbiOf, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOf,
11
+ LayoutOfHelpers, TyAndLayout,
12
12
};
13
13
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeFoldable, TypingEnv, Variance};
14
14
use rustc_middle::{mir, span_bug};
@@ -92,20 +92,6 @@ impl<'tcx, M: Machine<'tcx>> LayoutOfHelpers<'tcx> for InterpCx<'tcx, M> {
92
92
}
93
93
}
94
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(always)]
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
-
109
95
impl<'tcx, M: Machine<'tcx>> FnAbiOfHelpers<'tcx> for InterpCx<'tcx, M> {
110
96
type FnAbiOfResult = Result<&'tcx FnAbi<'tcx, Ty<'tcx>>, InterpErrorKind<'tcx>>;
111
97
@@ -121,6 +107,43 @@ impl<'tcx, M: Machine<'tcx>> FnAbiOfHelpers<'tcx> for InterpCx<'tcx, M> {
121
107
}
122
108
}
123
109
110
+ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
111
+ /// This inherent method takes priority over the trait method with the same name in LayoutOf,
112
+ /// and allows wrapping the actual [LayoutOf::layout_of] with a tracing span.
113
+ /// See [LayoutOf::layout_of] for the original documentation.
114
+ #[inline(always)]
115
+ pub fn layout_of(&self, ty: Ty<'tcx>) -> <Self as LayoutOfHelpers<'tcx>>::LayoutOfResult {
116
+ let _span = enter_trace_span!(M, "InterpCx::layout_of", ty = ?ty.kind());
117
+ LayoutOf::layout_of(self, ty)
118
+ }
119
+
120
+ /// This inherent method takes priority over the trait method with the same name in FnAbiOf,
121
+ /// and allows wrapping the actual [FnAbiOf::fn_abi_of_fn_ptr] with a tracing span.
122
+ /// See [FnAbiOf::fn_abi_of_fn_ptr] for the original documentation.
123
+ #[inline(always)]
124
+ pub fn fn_abi_of_fn_ptr(
125
+ &self,
126
+ sig: ty::PolyFnSig<'tcx>,
127
+ extra_args: &'tcx ty::List<Ty<'tcx>>,
128
+ ) -> <Self as FnAbiOfHelpers<'tcx>>::FnAbiOfResult {
129
+ let _span = enter_trace_span!(M, "InterpCx::fn_abi_of_fn_ptr", ?sig, ?extra_args);
130
+ FnAbiOf::fn_abi_of_fn_ptr(self, sig, extra_args)
131
+ }
132
+
133
+ /// This inherent method takes priority over the trait method with the same name in FnAbiOf,
134
+ /// and allows wrapping the actual [FnAbiOf::fn_abi_of_instance] with a tracing span.
135
+ /// See [FnAbiOf::fn_abi_of_instance] for the original documentation.
136
+ #[inline(always)]
137
+ pub fn fn_abi_of_instance(
138
+ &self,
139
+ instance: ty::Instance<'tcx>,
140
+ extra_args: &'tcx ty::List<Ty<'tcx>>,
141
+ ) -> <Self as FnAbiOfHelpers<'tcx>>::FnAbiOfResult {
142
+ let _span = enter_trace_span!(M, "InterpCx::fn_abi_of_instance", ?instance, ?extra_args);
143
+ FnAbiOf::fn_abi_of_instance(self, instance, extra_args)
144
+ }
145
+ }
146
+
124
147
/// Test if it is valid for a MIR assignment to assign `src`-typed place to `dest`-typed value.
125
148
/// This test should be symmetric, as it is primarily about layout compatibility.
126
149
pub(super) fn mir_assign_valid_types<'tcx>(
0 commit comments