Skip to content

Fix copy construction and assignment of Pieces #4068

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

powerboat9
Copy link
Collaborator

@powerboat9 powerboat9 commented Aug 12, 2025

Pointers stored in Pieces::pieces_vector refer to objects with lifetimes tied to Pieces::handle. This commit also removes the move constructor for Pieces, as it's equivalent to the copy constructor.

Pointers stored in Pieces::pieces_vector refer to objects with lifetimes
tied to Pieces::handle. This commit also removes the move constructor
for Pieces, as it's equivalent to the copy constructor.

gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::Pieces): Reconstruct pieces_vector
	when copying, remove move constructor.
	(Pieces::operator=): Reconstruct pieces_vector when copying.
	* ast/rust-fmt.h (Pieces::Pieces): Remove move constructor.

Signed-off-by: Owen Avery <[email protected]>
@powerboat9
Copy link
Collaborator Author

I've removed the move constructor instead of creating an accurate implementation, as I'd want to be very careful about maintaining invariants on a moved-from ffi::FormatArgsHandle

@powerboat9 powerboat9 marked this pull request as draft August 12, 2025 14:43
@powerboat9
Copy link
Collaborator Author

Superseded by #4074

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.

1 participant