diff --git a/Source/DafnyRuntime/DafnyRuntimeRust/src/lib.rs b/Source/DafnyRuntime/DafnyRuntimeRust/src/lib.rs index 13745ff9c0..75621f33af 100644 --- a/Source/DafnyRuntime/DafnyRuntimeRust/src/lib.rs +++ b/Source/DafnyRuntime/DafnyRuntimeRust/src/lib.rs @@ -3508,7 +3508,8 @@ impl AsRef for Object { fn increment_strong_count(data: *const T) { // SAFETY: This method is called only on values that were constructed from an Rc unsafe { - Rc::increment_strong_count(data); + // Black box avoids the compiler wrongly inferring that increment strong count does nothing since the data it was applied to can be traced to be borrowed + ::std::hint::black_box(Rc::increment_strong_count(data)); } }