Skip to content

Failure to fulfill higher-kinded "outlives" predicate could have better error message #27114

Description

@apasel422

Example:

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

fn bar<'b>() {
    foo::<&'b i32>();
}

fn main() {}

Error:

foo.rs:4:5: 4:19 error: the type `&'b i32` does not fulfill the required lifetime
foo.rs:4     foo::<&'b i32>();
             ^~~~~~~~~~~~~~
note: type must outlive the static lifetime
error: aborting due to previous error

It's not necessarily obvious why the type has to be 'static in this case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions