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 useful impls #172

Closed
wants to merge 4 commits into from
Closed

Add useful impls #172

wants to merge 4 commits into from

Conversation

Lapz
Copy link

@Lapz Lapz commented Feb 29, 2020

No description provided.

Copy link
Collaborator

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

I'm not sure how useful some of these are ... also they will bloat the binary size by quite a bit.

@@ -80,7 +80,7 @@ impl<FileId> Label<FileId> {

/// Represents a diagnostic message that can provide information like errors and
/// warnings to the user.
#[derive(Clone)]
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems a little large to derive Debug on ... can I ask your use case?

Copy link
Author

Choose a reason for hiding this comment

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

The debug one I can actually remove. My main use case for the impls is salsa. Salsa requires that arguments for a query must implement hash, eq and partialEq

Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems expensive to be in a salsa query, wouldn't it be faster to just recompute it instead of comparing all the strings to one another?

@@ -330,7 +330,7 @@ where
}

/// A file that is stored in the database.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make sense to compare files like this? Eq will be expensive and I'm not sure how useful it will be.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, I'm not sure about having these impls. 🤔

codespan-reporting/src/diagnostic.rs Show resolved Hide resolved
@Lapz
Copy link
Author

Lapz commented Feb 29, 2020 via email

@brendanzab
Copy link
Owner

No worries! I see you're also interested in Salsa! Note that I have been working on making it easier to implement custom Files databases in my most recently merged PRs - this will let you implement your own based on the codespan_reporting::files::Files trait. It's not yet up on crates.io though, but maybe it might be of use to you!

@Lapz
Copy link
Author

Lapz commented Mar 1, 2020

Kl I'll hold off with this then

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

3 participants