Skip to content

must_not_suspend lint regression with -Zdrop-tracking #97333

Closed
@eholk

Description

@eholk

The test case src/test/ui/lint/must_not_suspend/ref.rs fails when -Zdrop-tracking is enabled.

We are not recognizing the Umm type as held across a borrow. Here's the revelant code from the test:

async fn uhoh(&mut self) {
let guard = &mut self.u; //~ ERROR `Umm` held across
other().await;
*guard = Umm {
i: 2
}
}

In a way, that's correct. We aren't holding Umm across the borrow, we are holding &mut Umm. The question is whether this should trigger the lint? If not, we need some way to annotate &mut Umm as also not being able to be held across the borrow.

It looks like in check_must_not_suspend_ty, we already recurse through a few types, so maybe we should look through references too?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions