Skip to content
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

impl Debug/Default for Tracked #1450

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ziqiaozhou
Copy link
Collaborator

Add Debug and Default Trait for Tracked, so that a struct with derived Debug/Default can use Tracked field.

I have used some tracked variable in struct that implements Debug and Default. If I do not implement Debug and Default for Tracked, I will not be able to pass lifetime checker.

tracked struct P {
   no_copy: NoCopy,
}
#[derive(Debug, Default)]
struct X {
    x: [usize; 16],
    #[cfg(verus_keep_ghost_body)]
    y: Tracked<Map<int, P>>,
}

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@tjhance
Copy link
Collaborator

tjhance commented Feb 15, 2025

The Default implementation for Tracked<A> will allow the user to forge tracked tokens.

@ziqiaozhou
Copy link
Collaborator Author

The Default implementation for Tracked<A> will allow the user to forge tracked tokens.

Thanks for the comment. That is true. I removed the default. I think I can avoid using default trait.

@ziqiaozhou ziqiaozhou marked this pull request as ready for review February 20, 2025 00:20
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