Skip to content

NLL fails to remind users that locals in same scope are dropped in reverse declaration order #51195

Closed
@pnkfelix

Description

@pnkfelix

Looking at a case like E0597.rs, we can see that the AST-borrowck includes the note:

= note: values in a scope are dropped in the opposite order they are created

while NLL has no reminder about the drop order for a pair of locals declared in the same lexical scope.

  • (I personally am not a fan of the use of the word "created" in the error message there, since I attach that word to the dynamic semantics, while drop order is entirely defined by the declaration order, which is part of the static semantics (or really, part of the source syntax itself). The only thing that's potentially dynamic is whether or not a local variable actually holds a value at the moment that we go out of that local variable's scope.)

But anyway, the point is that NLL is failing to say anything at all on the matter, which is probably not ideal for Rust's target audience.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goal

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions