<p dir="auto">This code fails to compile:<br>
fn rereborrow(v: &amp;r/int) -&gt; &amp;r/int { &amp;_&amp;_v }</p>
<p dir="auto">fn main() {}</p>
<p dir="auto">With error:<br>
test.rs:1:38: 1:42 error: illegal borrow: borrowed value does not live long enough<br>
test.rs:1 fn rereborrow(v: &amp;r/int) -&gt; &amp;r/int { &amp;_&amp;<em>v }<br>
^~~~<br>
test.rs:1:35: 1:44 note: borrowed pointer must be valid for the lifetime &amp;r as defined on the block at 1:35...<br>
test.rs:1 fn rereborrow(v: &amp;r/int) -&gt; &amp;r/int { &amp;</em>&amp;<em>v }<br>
^~~~~~~~~<br>
test.rs:1:35: 1:44 note: ...but borrowed value is only valid for the block at 1:35<br>
test.rs:1 fn rereborrow(v: &amp;r/int) -&gt; &amp;r/int { &amp;</em>&amp;_v }<br>
^~~~~~~~~<br>
error: aborting due to previous error</p>
<p dir="auto">shell returned 101</p>
<p dir="auto">In this test case (<code class="notranslate">src/test/run-pass/region-return-interior-of-option-in-self.rs</code>):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// xfail-test 

struct cell&lt;T&gt; {
    value: T;
}

struct cells&lt;T&gt; {
    vals: ~[option&lt;cell&lt;T&gt;&gt;];
}

impl&lt;T&gt; &amp;cells&lt;T&gt; {
    fn get(idx: uint) -&gt; &amp;self/T {
        match self.vals[idx] {
          some(ref v) =&gt; &amp;v.value,
          none =&gt; fail
        }
    }
}

fn main() {}"><pre class="notranslate"><code class="notranslate">// xfail-test 

struct cell&lt;T&gt; {
    value: T;
}

struct cells&lt;T&gt; {
    vals: ~[option&lt;cell&lt;T&gt;&gt;];
}

impl&lt;T&gt; &amp;cells&lt;T&gt; {
    fn get(idx: uint) -&gt; &amp;self/T {
        match self.vals[idx] {
          some(ref v) =&gt; &amp;v.value,
          none =&gt; fail
        }
    }
}

fn main() {}
</code></pre></div>
<p dir="auto">an error is reported.  The reason is that the region <code class="notranslate">R</code> for <code class="notranslate">v</code> is inferred to be too narrow, because it doesn't realize <code class="notranslate">R</code> must be as wide as the region for <code class="notranslate">&amp;v.value</code>.</p>