1
Fork 0

add method to get absolute address of a pointer (useful only for Miri)

This commit is contained in:
Ralf Jung 2022-04-18 11:43:13 -04:00
parent c9e568f72e
commit 3236092503
3 changed files with 14 additions and 6 deletions

View file

@ -207,6 +207,16 @@ impl<Tag> Pointer<Option<Tag>> {
None => Err(self.offset),
}
}
/// Returns the absolute address the pointer points to.
/// Only works if Tag::OFFSET_IS_ADDR is true!
pub fn addr(self) -> Size
where
Tag: Provenance,
{
assert!(Tag::OFFSET_IS_ADDR);
self.offset
}
}
impl<Tag> Pointer<Option<Tag>> {