Skip to content

Commit 146792a

Browse files
committed
only use check_leaks with debug_assertions
1 parent 672ac28 commit 146792a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/rustc_infer/src/infer/snapshot/check_leaks.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for HasSnapshotLeaksVisitor {
9696
}
9797

9898
#[macro_export]
99+
#[cfg(debug_assertions)]
99100
macro_rules! type_foldable_verify_no_snapshot_leaks {
100101
($tcx:lifetime, $t:ty) => {
101102
const _: () = {
@@ -116,7 +117,7 @@ macro_rules! type_foldable_verify_no_snapshot_leaks {
116117
(value, visitor)
117118
}
118119
fn avoid_leaks(_: &InferCtxt<$tcx>, (value, mut visitor): Self::EndData) -> Self {
119-
if cfg!(debug_assertions) && value.visit_with(&mut visitor).is_break() {
120+
if value.visit_with(&mut visitor).is_break() {
120121
bug!("leaking vars from snapshot: {value:?}");
121122
}
122123

@@ -126,3 +127,11 @@ macro_rules! type_foldable_verify_no_snapshot_leaks {
126127
};
127128
};
128129
}
130+
131+
#[macro_export]
132+
#[cfg(not(debug_assertions))]
133+
macro_rules! type_foldable_verify_no_snapshot_leaks {
134+
($tcx:lifetime, $t:ty) => {
135+
trivial_no_snapshot_leaks!($tcx, $t)
136+
};
137+
}

0 commit comments

Comments
 (0)