Files
Rodrigo Rejala 1fa8356e6b fix(rust-patterns-book): make Lifetime Branding example enforce compile-time safety
The arena/handle lifetime branding example used covariant PhantomData<&'a ()>,
which allowed the compiler to unify lifetimes across different arena instances.
The cross-arena usage compiled successfully but panicked at runtime.

Fix by:
- Making ArenaHandle invariant over 'arena with PhantomData<*mut &'arena ()>
  so handles from different arenas can't be mixed
- Using a with_arena() closure that creates a unique, opaque lifetime per call,
  preventing the compiler from unifying lifetimes across arena instances
- Changing get() to take &ArenaHandle to avoid ownership conflicts

Fixes #107
2026-06-10 21:19:38 -03:00
..
2026-03-24 21:05:38 +01:00
2026-03-23 11:45:55 -07:00
2026-03-23 11:45:55 -07:00