Closed
Description
This test file incorrect returns a compilation error:
struct S;
type F = fn<'cx>(&'cx S) -> &'cx S;
fn foo(x: &S) -> &'static S { fail!() }
fn want_F(f: F) { }
pub fn main() {
want_F(foo); // Incorrect error here
}
In particular, a fn like foo
which always returns a pointer with 'static
lifetime should be considered a subtype of a fn type that always returns pointer with same lifetime as its input.
Metadata
Metadata
Assignees
Labels
No labels