You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.