Non-Lexical Lifetimes in Rust Arrives for Everyone
Looks lexical to me, if we just add braces:<p><pre><code>  fn main() {                               &#x2F;&#x2F; SCOPE TREE
                                          &#x2F;&#x2F;
    let mut names =                       &#x2F;&#x2F; +- `names` scope start
        [&quot;abe&quot;, &quot;beth&quot;, &quot;cory&quot;, &quot;diane&quot;]; &#x2F;&#x2F; |
                                          &#x2F;&#x2F; |
    let alias = &amp;mut names[0];            &#x2F;&#x2F; | +- `alias` scope start
                                          &#x2F;&#x2F; | |
    *alias = &quot;alex&quot;; &#x2F;&#x2F; &lt;------------------------ write to `*alias`
                                          &#x2F;&#x2F; | |
    println!(&quot;{}&quot;, names[0]); &#x2F;&#x2F; &lt;--------------- read of `names[0]`
                                          &#x2F;&#x2F; | |
                                          &#x2F;&#x2F; | +- `alias` scope end
                                          &#x2F;&#x2F; +- `name` scope end
  }
</code></pre>
That is to say:<p><pre><code>  fn main() {                               &#x2F;&#x2F; SCOPE TREE
                                          &#x2F;&#x2F;
    let mut names =                       &#x2F;&#x2F; +- `names` scope start
        [&quot;abe&quot;, &quot;beth&quot;, &quot;cory&quot;, &quot;diane&quot;]; &#x2F;&#x2F; |
                                          &#x2F;&#x2F; |
    { let alias = &amp;mut names[0];            &#x2F;&#x2F; | +- `alias` scope start
                                          &#x2F;&#x2F; | |
      *alias = &quot;alex&quot;; } &#x2F;&#x2F; &lt;------------------------ write to `*alias`
                                          &#x2F;&#x2F; | |
    println!(&quot;{}&quot;, names[0]); &#x2F;&#x2F; &lt;--------------- read of `names[0]`
                                          &#x2F;&#x2F; | |
                                          &#x2F;&#x2F; | +- `alias` scope end
                                          &#x2F;&#x2F; +- `name` scope end
  }
</code></pre>
If <i>that</i> can be made to work without diagnostics, it&#x27;s a better solution than playing games with <i>de facto</i> tying scopes to the last uses of identifiers.