Skip to content

Unhelpful compiler message when a reference is used inside of an await block #72312

Closed
@DusterTheFirst

Description

@DusterTheFirst

When using a reference to self in an instance method and then attempting to call another method on the self reference inside of a async block (static lifetime) i get this unhelpful error, that does not mention anywhere where the usage of self is problematic. All it shows is where the block begins, and then where the self was defined.

image

The actual problem was on line 106, never mentioned in the error (inside of the async block)
image

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions