Skip to content

generator + nll : creating movable self referencing object #47516

Closed
@TeXitoi

Description

@TeXitoi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions