Function autoken::assume_no_alias_in
source · pub fn assume_no_alias_in<T: ?Sized, Res>(f: impl FnOnce() -> Res) -> Res
Expand description
Asserts that the provided closure’s virtual borrows to tokens of type T
will not cause any
aliasing issues at runtime.
In regular builds, this does nothing, but when AuToken checks a given binary, it uses calls to functions like this to determine whether a program has the possibility of virtually borrowing a global token in a way which violates XOR borrowing rules.
Global token identity is lifetime-erased (i.e. &'a u32
and &'b u32
always refer to the same
virtual global token). When T
is Nothing
, nothing happens.