Skip to content

impl<A: Copy> Copy for Tracked<A> #931

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

Merged
merged 3 commits into from
Mar 11, 2024
Merged

impl<A: Copy> Copy for Tracked<A> #931

merged 3 commits into from
Mar 11, 2024

Conversation

tjhance
Copy link
Collaborator

@tjhance tjhance commented Dec 11, 2023

No description provided.

Copy link
Collaborator

@Chris-Hawblitzel Chris-Hawblitzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could already do this indirectly anyway:

fn d<A: Copy>(Tracked(x): Tracked<A>) -> (Tracked<A>, Tracked<A>) {
    (Tracked(x), Tracked(x))
}

so there's no harm in also allowing it directly.

@@ -458,6 +458,16 @@ impl<A> Clone for Ghost<A> {

impl<A> Copy for Ghost<A> {}

impl<A: Copy> Clone for Tracked<A> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be A: Clone, to be more flexible?

Copy link
Collaborator Author

@tjhance tjhance Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually supported Tracked::clone at all right now. If we did support it, how do you think it should work? We either treat it like a 'copy' (in which we case we do need the A: Copy bound here, as I wrote) or we treat it like Tracked(a.borrow.clone()). Even defining Clone for a tracked object when it's not Copy is already a pretty unusual operation. My inclination is to continue not supporting Tracked::clone, in which case it doesn't really matter what this bound is.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess Clone::clone wouldn't work on the A value anyway, because it's an exec function taking an exec argument, not a proof function taking a tracked argument.

@tjhance
Copy link
Collaborator Author

tjhance commented Mar 1, 2024

If anyone is wondering about the status of this, I decided to wait until my other work on the Clone trait is done.

@tjhance tjhance force-pushed the make-tracked-copy branch from ee6d0be to 9e220d2 Compare March 11, 2024 15:09
@tjhance tjhance merged commit 7fdcc8b into main Mar 11, 2024
@tjhance tjhance deleted the make-tracked-copy branch March 11, 2024 15:23
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.

2 participants