Skip to content

Lifetime inference and Pin #54934

Open
Open
@withoutboats

Description

@withoutboats

There appears to be some lifetime inference issue with how Deref is implemented for Pin, so that I get issues about how the pin does not live long in code that should clearly work. For example, this gives an error about how the pin does not live long enough:

fn foo<'a>(x: Pin<&'a i32>) -> &'a i32 {
    &*x
}

https://play.rust-lang.org/?gist=5749b0645d17308d62501924e618e49d&version=nightly&mode=debug&edition=2015

cc #49150

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inferenceArea: Type inferenceA-type-systemArea: Type systemC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types 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