Skip to content

Commit 9c9b5c9

Browse files
JakobDegenmeta-codesync[bot]
authored andcommitted
lifetimes: Reuse heap in another test
Summary: `Eq` and `PartialEq` are only implemented for two `Value<'v>`s, not for one `Value<'v1>` and one `Value<'v2>`, but this test was comparing values coming from two different heaps. We could actually consider changing the eq behavior to allow this, but that would in turn require changing the signature on all `StarlarkValue`s and this doesn't seem like good motivation yet. Reviewed By: ship-it-ship-it Differential Revision: D90475052 fbshipit-source-id: 4b3c8b70e5ae1b6db37c55f39262c39efd44b147
1 parent 1e04e8c commit 9c9b5c9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

starlark/src/assert/assert.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,14 @@ impl<'a> Assert<'a> {
572572
/// ```
573573
pub fn eq(&self, lhs: &str, rhs: &str) {
574574
self.with_gc(|gc| {
575-
Module::with_temp_heap(|lhs_m| {
576-
Module::with_temp_heap(|rhs_m| {
577-
let lhs_v = self.execute_unwrap("eq", "lhs.bzl", lhs, &lhs_m, gc);
578-
let rhs_v = self.execute_unwrap("eq", "rhs.bzl", rhs, &rhs_m, gc);
579-
if lhs_v != rhs_v {
580-
panic!(
581-
"starlark::assert::eq, values differ!
575+
Heap::temp(|heap| {
576+
let lhs_m = Module::with_heap(heap);
577+
let rhs_m = Module::with_heap(heap);
578+
let lhs_v = self.execute_unwrap("eq", "lhs.bzl", lhs, &lhs_m, gc);
579+
let rhs_v = self.execute_unwrap("eq", "rhs.bzl", rhs, &rhs_m, gc);
580+
if lhs_v != rhs_v {
581+
panic!(
582+
"starlark::assert::eq, values differ!
582583
Code 1:
583584
{lhs}
584585
Code 2:
@@ -587,9 +588,8 @@ Value 1:
587588
{lhs_v}
588589
Value 2
589590
{rhs_v}"
590-
);
591-
}
592-
})
591+
);
592+
}
593593
})
594594
})
595595
}

0 commit comments

Comments
 (0)