Function autoken::assume_no_alias_in_many
source · pub fn assume_no_alias_in_many<T, Res>(f: impl FnOnce() -> Res) -> Reswhere
T: ?Sized + Tuple,
Expand description
Asserts that the provided closure’s virtual borrows to tokens of type (T_1, ..., T_n)
will not
cause any aliasing issues at runtime.
T
must be a tuple of token types to ignore. Its maximum supported arity is 12.
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 a component in T
is Nothing
, it is effectively ignored.