2 ms·
> Similarly, when I call a function I create a new environment (think, stack frame) for each call which contains values that are distinct from all other calls.
by masklinn 2y ago
> Similarly, when I call a function I create a new environment (think, stack frame) for each call which contains values that are distinct from all other calls. I would expect the same to hold for types defined within a function.
Rust types are not runtime objects.
Also just because a function call creates a new environment doesn't mean everything is part of that environment. `static` items are singletons, even if defined within a function (which is a common case when the function should be the only thing directly interacting with the static).