Please don't use HTML when posting to lists.

> 2) function parameter types or return type that are not type parameters have
> all the same implicit lifetime by default, but they can be qualified
> explicitly with some lifetime.
That would mean that a function with default-lifetime parameters taking two 
borrowing references could not be called when the two parameters have different 
lifetime, if I understand correctly (though I am not aware of the whole 
situation). Example:

fn f<'l>(x : & 'l int, y : & 'l int) -> & 'l int {
    x
}

fn caller<'l>(x : & 'l int) -> & 'l int {
    let y = 2;
    f(x, &y)
}

fn main() {
    let x = 5;
    io::println(fmt!("%i", *caller(&x)));
}

(This fails, but giving parameter y an independent lifetime makes it succeed.)

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to