Skip to content

Higher-kinded lifetime bounds could be smarter #26217

Closed
@apasel422

Description

@apasel422

The following code fails to compile despite i32: 'static:

fn foo<T>() where for<'a> T: 'a {}

fn main() {
    foo::<i32>();
}

The exact error is:

foo.rs:4:5: 4:15 error: the requirement `for<'a> i32 : 'a` is not satisfied [E0280]
foo.rs:4     foo::<i32>();
             ^~~~~~~~~~

Per @nikomatsakis's comment here, it seems that T: 'static could imply for<'a> T: 'a.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions