Skip to content

Async struct method, <_'> lifetime shadowing #64630

Closed
@fominok

Description

@fominok

Hello, I ran into a problem using <'_> lifetime with async struct methods, here is the example:

struct Foo<'a> { swag: &'a i32 }

impl Foo<'_> {
    async fn bar(&self) -> i32 {
        1337
    }
}

The error is:
error[E0496]: lifetime name '_ shadows a lifetime name that is already in scope

Everything is fine if I use explicit lifetime like 'a.

Version: 1.39 Nighly (2019-09-19 9b9d2af on playground)

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-lifetimesArea: Lifetimes / regionsAsyncAwait-PolishAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.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