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

Add Debug implementation with clippy #5515

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tcoratger
Copy link
Contributor

@tcoratger tcoratger commented May 7, 2024

In circumstances like cairo_native, and other projects working on Cairo and its compilation, it is extremely useful to have a Debug implementation for each public structure and enum.

Therefore, the lint MISSING_DEBUG_IMPLEMENTATIONS is added with a derivation of Debug wherever possible, along with an allow attribute when the implementation is more complex.

This allows for the implementation of Debug for a large number of new objects that did not previously have this implementation, with the potential for further refinement in the future.


This change is Reviewable

@tcoratger tcoratger requested a review from mkaput as a code owner May 7, 2024 14:42
@mkaput mkaput requested review from orizi and removed request for mkaput May 7, 2024 14:56
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 26 of 129 files at r1, all commit messages.
Reviewable status: 26 of 129 files reviewed, 1 unresolved discussion (waiting on @tcoratger)

a discussion (no related file):
i'm not sure at all we actually want this - a lot of the crates are mostly internal crates that are not expected to be used by tools like cairo_native and such - unless we have a lot of such cases where we have something missing - i'd rather avoid the additional costs of having it everywhere (in compile time).


Copy link
Contributor Author

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

Reviewable status: 26 of 129 files reviewed, 1 unresolved discussion (waiting on @orizi)

a discussion (no related file):

Previously, orizi wrote…

i'm not sure at all we actually want this - a lot of the crates are mostly internal crates that are not expected to be used by tools like cairo_native and such - unless we have a lot of such cases where we have something missing - i'd rather avoid the additional costs of having it everywhere (in compile time).

Would you accept other PRs on a case by case basis? I would first think about ProgramRegistry where a debug derivation would be more than useful for debugging in various tools.


Copy link
Contributor Author

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

Reviewable status: 26 of 129 files reviewed, 1 unresolved discussion (waiting on @orizi)

a discussion (no related file):

Previously, tcoratger (Thomas Coratger) wrote…

Would you accept other PRs on a case by case basis? I would first think about ProgramRegistry where a debug derivation would be more than useful for debugging in various tools.

But on the other hand, I think that the Debug derivation can be useful also inside the compiler itself for various debugging scenarios. And I don't have the impression that it increases the compilation time much. What do you think?


Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewable status: 26 of 129 files reviewed, 1 unresolved discussion (waiting on @tcoratger)

a discussion (no related file):

Previously, tcoratger (Thomas Coratger) wrote…

But on the other hand, I think that the Debug derivation can be useful also inside the compiler itself for various debugging scenarios. And I don't have the impression that it increases the compilation time much. What do you think?

a case by case basic would totally be fine - but particularly - the ProgramRegistry sounds to me like an example of something that would be barely usable - as the Sierra Program itself would be more useful to begin with.

We need to analyse it as a case by case to see if we need the debug - for a lot of existing structure adding such a debug might be more confusing (just because there's the entire DebugWithDb structure all around the project, for salsa based stuff)


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.

None yet

2 participants