Skip to content

Fsk issue 4691 catch bad fsu during compute moves #9350

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

Conversation

pnkfelix
Copy link
Member

Resolves third bullet of #4691: if the functional-struct-update (FSU) expression { a: b, ..s } causes s to move and s has a destructor, then the expression is illegal.

r? @nikomatsakis

@nikomatsakis
Copy link
Contributor

Felix -- this looks like a good patch. My one concern is that it means that the dtor rule is enforced in two distinct places (one in moves.rs -- which is not otherwise tasked with reporting errors -- and also in gather_moves check_is_legal_to_move_from()). This concerns me lest new rules related to moves should arise. The fix I had in mind (having FSU's generate moves in gather_moves for all fields that are consumed) would seem to address that, at the cost of duplicating the logic for computing which fields are consumed. What do you think?

@nikomatsakis
Copy link
Contributor

After discussion on IRC, @pnkfelix and I decided to take this patch and possibly refactor later as part of ongoing effort to stop zeroing out moved data.

bors added a commit that referenced this pull request Sep 21, 2013
…ng-compute-moves, r=nikomatsakis

Resolves third bullet of #4691: if the functional-struct-update (FSU) expression `{ a: b, ..s }` causes `s` to move and `s` has a destructor, then the expression is illegal.

r? @nikomatsakis
@bors bors closed this Sep 21, 2013
@bors bors merged commit 4e543f7 into rust-lang:master Sep 21, 2013
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.

3 participants