I really like that thought. AspNetCore, for example, has request-scoped things in their DI container, but of course there's no checking and many times I've seen bugs from people passing something resolved to something static-scoped that ends up getting cached across requests causing weird problems at runtime. Having an actual lifetime for this sounds great -- it reminds me of the 'tcx
in rustc
...
(Edit: there could even be a method like Box::leak
that returns things 'request
instead of 'static
.)