Skip to content

NLL and Borrowck dataflow disagree on the meaning of a location #46875

Closed
@nikomatsakis

Description

@nikomatsakis

In the NLL regions, if a region contains a location L, that means that the region contains the entry point to that location. In the borrow dataflow, however, when we apply statement effects, they take place on the exit from a location. The end result is that kills for borrows are applied slightly too late. Consider something like:

L1: P = &X;
L2: use(P); // last use
L3: X = 1;

The region for P would be inferred to {L1, L2}. Therefore, the kill of L2 needs to include the borrow on line 1. However, what we actually do is to insert the kill after L3.

I noticed this because I was trying to stop emitting EndRegion statements when using NLL. However, this caused false errors to be omitted. For now, there is a FIXME in the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)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