Skip to content

generator + nll : creating movable self referencing object #47516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TeXitoi opened this issue Jan 17, 2018 · 1 comment
Closed

generator + nll : creating movable self referencing object #47516

TeXitoi opened this issue Jan 17, 2018 · 1 comment
Labels
A-coroutines Area: Coroutines A-NLL Area: Non-lexical lifetimes (NLL) I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TeXitoi
Copy link
Contributor

TeXitoi commented Jan 17, 2018

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 nikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness A-NLL Area: Non-lexical lifetimes (NLL) A-coroutines Area: Coroutines WG-compiler-nll labels Jan 17, 2018
@Zoxc
Copy link
Contributor

Zoxc commented Jan 17, 2018

This is fixed by #45337.

@Zoxc Zoxc closed this as completed Jan 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-coroutines Area: Coroutines A-NLL Area: Non-lexical lifetimes (NLL) I-unsound Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants