-
Notifications
You must be signed in to change notification settings - Fork 61
Mutable references vs self-referential structs #148
Copy link
Copy link
Open
Labels
A-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Metadata
Metadata
Assignees
Labels
A-aliasing-modelTopic: Related to the aliasing model (e.g. Stacked/Tree Borrows)Topic: Related to the aliasing model (e.g. Stacked/Tree Borrows)C-open-questionCategory: An open question that we should revisitCategory: An open question that we should revisitS-pending-designStatus: Resolving this issue requires addressing some open design questionsStatus: Resolving this issue requires addressing some open design questions
Type
Fields
Give feedbackNo fields configured for issues without a type.
Turns out that stacked borrows and self-referential generators don't go well together. This code fails in Miri:
The reason it fails is that each time through the loop, we call
Pin::as_mut, which creates a fresh mutable reference to the generator. Since mutable references are unique, that invalidates the pointer that points from one field of the generator to another.This is basically a particularly bad instance of #133.
Cc @cramertj @tmandry @nikomatsakis @arielb1