fix function_casts_as_integer warning
Comparing addresses of function pointers is brittle. Functions may be duplicated resulting in function pointers to the same function to compare !=. Functions may be merged/de-duplicated resulting in function pointers to different function to compare ==. The later shouldn't be relevant here as the function differ in behavior, but mentioning it for completeness.
This commit is contained in:
@@ -1104,7 +1104,7 @@ impl MachineState {
|
||||
}
|
||||
_ => {
|
||||
push_cell!(self, heap_loc_as_cell!(h), return);
|
||||
(self.bind_fn)(self, Ref::heap_cell(h), value);
|
||||
self.occurs_check.bind(self, Ref::heap_cell(h), value);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ impl MachineState {
|
||||
push_cell!(self, heap_loc_as_cell!(h), return);
|
||||
|
||||
let addr = self.store(self[r]);
|
||||
(self.bind_fn)(self, Ref::heap_cell(h), addr);
|
||||
self.occurs_check.bind(self, Ref::heap_cell(h), addr);
|
||||
|
||||
// the former code of this match arm was:
|
||||
|
||||
@@ -1235,7 +1235,7 @@ impl MachineState {
|
||||
let h = self.heap.cell_len();
|
||||
push_cell!(self, heap_loc_as_cell!(h), return);
|
||||
|
||||
(self.bind_fn)(self, Ref::heap_cell(h), addr);
|
||||
self.occurs_check.bind(self, Ref::heap_cell(h), addr);
|
||||
self.registers[arg] = heap_loc_as_cell!(h);
|
||||
}
|
||||
|
||||
@@ -1281,7 +1281,7 @@ impl MachineState {
|
||||
if stored_v.is_stack_var() {
|
||||
let h = self.heap.cell_len();
|
||||
push_cell!(self, heap_loc_as_cell!(h), return);
|
||||
(self.bind_fn)(self, Ref::heap_cell(h), stored_v);
|
||||
self.occurs_check.bind(self, Ref::heap_cell(h), stored_v);
|
||||
} else {
|
||||
push_cell!(self, stored_v, return);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user