Skip to content

references: correct the exclusive-reference speaker note for NLL - #3243

Open
rmyndharis wants to merge 1 commit into
google:mainfrom
rmyndharis:fix/nll-exclusive-ref-note
Open

references: correct the exclusive-reference speaker note for NLL#3243
rmyndharis wants to merge 1 commit into
google:mainfrom
rmyndharis:fix/nll-exclusive-ref-note

Conversation

@rmyndharis

Copy link
Copy Markdown

The note suggested accessing point.0 "while x_coord is alive", but under
non-lexical lifetimes the mutable borrow of point.0 ends at the last use
of x_coord (*x_coord = 20;). Accessing point.0 after that line
therefore compiles and no longer demonstrates the restriction. Reword the
note to explain that a borrow lasts until its last use, and to insert the
conflicting access before that last use to reproduce the borrow error.

Closes #2246.

The note suggested accessing `point.0` "while x_coord is alive", but under
non-lexical lifetimes the mutable borrow of `point.0` ends at the last use
of `x_coord` (`*x_coord = 20;`). Accessing `point.0` after that line
therefore compiles and no longer demonstrates the restriction. Reword the
note to explain that a borrow lasts until its last use, and to insert the
conflicting access before that last use to reproduce the borrow error.

Closes google#2246.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-lexical lifetimes on exclusive reference

1 participant