-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-coroutinesArea: CoroutinesArea: CoroutinesI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Using generator and nll, one can create an object that point to itself, and then move it.
example outputing garbadge: https://play.rust-lang.org/?gist=ae6ddabbc8ddc411dcedd3fc48a8ee28&version=nightly
Reddit discution: https://www.reddit.com/r/rust/comments/7qwe76/self_borrowing_struct_and_generators/
As pointed by a redditor, #47353 point that @nikomatsakis know there is borrowing issues. Here is an example of such a problematic case.
nikomatsakis
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-coroutinesArea: CoroutinesArea: CoroutinesI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.