title: Return a closure from a function
body: <blockquote>
    <p>Note that this question pertains to a version of Rust before 1.0 was released</p>
  </blockquote>
  
  <p>Do I understand correctly that it is now impossible to return a closure from a function, unless it was provided to the function in its arguments? It is very useful approach, for example, when I need the same block of code, parameterized differently, in different parts of program. Currently the compiler does not allow something like this, naturally:</p>
  
  <pre><code>fn make_adder(i: int) -&gt; |int| -&gt; int {
      |j| i + j
  }
  </code></pre>
  
  <p>The closure is allocated on the stack and is freed upon returning from a function, so it is impossible to return it.</p>
  
  <p>Will it be possible to make this work in future? I heard that dynamically-sized types would allow this.</p>