Skip to content

Commit

Permalink
Merge pull request #642 from Veykril/veykril/push-xvqwlzlvnptp
Browse files Browse the repository at this point in the history
Improve safety comments on function/fetch
  • Loading branch information
Veykril authored Jan 4, 2025
2 parents 88a1d77 + 63c367b commit 32bd57c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
14 changes: 6 additions & 8 deletions src/function/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ where
if memo.value.is_some()
&& self.shallow_verify_memo(db, zalsa, self.database_key_index(id), memo)
{
// Unsafety invariant: memo is present in memo_map
unsafe {
return Some(self.extend_memo_lifetime(memo));
}
// Unsafety invariant: memo is present in memo_map and we have verified that it is
// still valid for the current revision.
return unsafe { Some(self.extend_memo_lifetime(memo)) };
}
}
None
Expand All @@ -81,10 +80,9 @@ where
let opt_old_memo = self.get_memo_from_table_for(zalsa, id);
if let Some(old_memo) = &opt_old_memo {
if old_memo.value.is_some() && self.deep_verify_memo(db, old_memo, &active_query) {
// Unsafety invariant: memo is present in memo_map.
unsafe {
return Some(self.extend_memo_lifetime(old_memo));
}
// Unsafety invariant: memo is present in memo_map and we have verified that it is
// still valid for the current revision.
return unsafe { Some(self.extend_memo_lifetime(old_memo)) };
}
}

Expand Down
21 changes: 0 additions & 21 deletions src/function/input_outputs.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl dyn TablePage {
fn make_id(page: PageIndex, slot: SlotIndex) -> Id {
let page = page.0 as u32;
let slot = slot.0 as u32;
Id::from_u32(page << PAGE_LEN_BITS | slot)
Id::from_u32((page << PAGE_LEN_BITS) | slot)
}

fn split_id(id: Id) -> (PageIndex, SlotIndex) {
Expand Down

0 comments on commit 32bd57c

Please sign in to comment.