pub(crate) fn two_pass_alias_guard(
metadata: &[TokenStream],
args: &[TokenStream],
preparations: &[(usize, Preparation)],
) -> TokenStreamExpand description
The alias check of a wrapper or trait shim with preparable arguments (#1504), in two passes:
assert_or_selectchecksmetadata(everyEithertaken with both arms). A conflict that involves no top-levelEitherraises; one that does marks theEitherargument instead.- Each marked argument is prepared (its
(index, preparation)inpreparations): the conversion runs up to the point where it would build a native reference, which tells its arm. Its metadata becomes what that arm borrows, andassert_no_aliaseschecks again.
The bindings are declared before the check, Unprepared, for the
arguments’ conversions to read. NativeBorrow::selects on each
argument’s metadata, a constant except for a copied trait signature,
gates its preparation; when no argument selects, the check is the
one-pass assert_no_aliases of a wrapper without preparations, so a call
that holds no top-level Either runs the same check as before after
optimisation. Without a mark, the second pass doesn’t run.