If that’s all you want, then closures are perfectly fine and able to achieve this goal. (In fact, that is the point of closures.)
Good to know. However, my short advice is simply “please don’t”.
Both dynamic scoping in general, and the specific example you cited, severely impede local reasoning. And by “reasoning”, I mean “reasoning by readers of the code”. Even if this could be technically possible by teaching the compiler new tricks, I would very strongly oppose the idea, because it hides important information that is essential for a complete and correct understanding of the code.
Effectively, what this does is introducing an implicit global variable (or, when used generously, many of them). Implicit globals have been tried in many programming languages before, and the general professional consensus today is that the concept was a mistake and an anti-pattern. I think it would be a step backwards if Rust adopted anything like this.
The main reason: since there can be arbitrary (textual) distance between the definition and the use of a function, this feature would also allow that there is arbitrarily large distance between the definition (and call site) of a “sub function” and the variables it refers to. This means that a part of the state the function captures might not even be in sight when one is reading the body or a use of the function. This most likely results in confusion and a misunderstanding of the code, which is exacerbated if the implementation of said functions are subsequently modified.
Thinking about it, what you describe here is basically a plain old object. If you have a bunch of state that you want to reuse across functions multiple times, the right way to do it is creating a type for it and making the functions that use it methods of the type. This way, the relationships and dependencies between code and data are clearly visible, and the compiler can also prove the correctness of the involved code more easily.
To be clear, it is usually the case that the burden of producing clear code should be on the writer, and not that the burden of understanding complex code making use of arbitrarily many language features should be on the reader. Therefore, any advantage in ergonomics of reading the code should be weighted much more than writing convenience. Ad-hoc external state accumulation is a prime example of this principle in action.
Therefore, I suggest that instead of adding action at a distance to the language, take a step back, and revise the design of your code. You might spot some opportunities for cleanup and refactoring, including better organization of data in appropriate types.