Closed
Description
In this test case (src/test/run-pass/region-return-interior-of-option-in-self.rs
):
// xfail-test
struct cell<T> {
value: T;
}
struct cells<T> {
vals: ~[option<cell<T>>];
}
impl<T> &cells<T> {
fn get(idx: uint) -> &self/T {
match self.vals[idx] {
some(ref v) => &v.value,
none => fail
}
}
}
fn main() {}
an error is reported. The reason is that the region R
for v
is inferred to be too narrow, because it doesn't realize R
must be as wide as the region for &v.value
.