Skip to content

Commit cf9186e

Browse files
committed
interpret: only to track_caller in debug builds due to perf
1 parent 1e0f3cb commit cf9186e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_const_eval/src/interpret/operand.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
7171
}
7272

7373
#[inline]
74-
#[track_caller]
74+
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
7575
pub fn to_scalar_or_uninit(self) -> ScalarMaybeUninit<Tag> {
7676
match self {
7777
Immediate::Scalar(val) => val,
@@ -80,13 +80,13 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
8080
}
8181

8282
#[inline]
83-
#[track_caller]
83+
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
8484
pub fn to_scalar(self) -> InterpResult<'tcx, Scalar<Tag>> {
8585
self.to_scalar_or_uninit().check_init()
8686
}
8787

8888
#[inline]
89-
#[track_caller]
89+
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
9090
pub fn to_scalar_or_uninit_pair(self) -> (ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>) {
9191
match self {
9292
Immediate::ScalarPair(val1, val2) => (val1, val2),
@@ -95,7 +95,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
9595
}
9696

9797
#[inline]
98-
#[track_caller]
98+
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
9999
pub fn to_scalar_pair(self) -> InterpResult<'tcx, (Scalar<Tag>, Scalar<Tag>)> {
100100
let (val1, val2) = self.to_scalar_or_uninit_pair();
101101
Ok((val1.check_init()?, val2.check_init()?))

0 commit comments

Comments
 (0)