Module partial_monomorphization

Source
Expand description

This module implements partial monomorphization, which allows specializing generic items on some specific instanciation patterns. This is used by Aeneas to avoid nested mutable borrows: we transform Iter<'a, &'b mut T> to {Iter::<_, &mut U>}<'a, 'b, T>, where

โ“˜
struct {Iter::<'a, &'b mut U>}<'a, 'b, U> {
  // the field of `Iter` but instantiated with `T -> &'b mut U`.
}

Note: We may need to partial-mono the same item multiple times: Foo::<&mut A, B>, Foo::<A, &mut B>. Note also that partial-mono is infectious: Foo<Bar<&mut A>> generates Bar::<&mut A> then `Foo::<Bar::<&mut A>>``.

Structsยง

MutabilityShapeBuilder ๐Ÿ”’
See the docs of MutabilityShapeBuilder::compute_shape.
PartialMonomorphizer ๐Ÿ”’
Transform

Type Aliasesยง

MutabilityShape ๐Ÿ”’