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

Fix non-deterministic error messages #2

Merged
merged 3 commits into from
Aug 25, 2021

Conversation

ilslv
Copy link
Member

@ilslv ilslv commented Aug 25, 2021

Synopsis

As described here error messages are non-deterministic.

Solution

Sort names field after converting it from HashSet<syn::Ident>.

Checklist

  • Created PR:
    • In draft mode
    • Name contains Draft: prefix
    • Name contains issue reference
    • Has k:: labels applied
    • Has assignee
  • Documentation is updated (if required)
  • Tests are updated (if required)
  • Changes conform code style
  • CHANGELOG entry is added (if required)
  • FCM (final commit message) is posted
    • and approved
  • Review is completed and changes are approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • Draft: prefix is removed
    • All temporary labels are removed

@ilslv ilslv added the enhancement New feature or request label Aug 25, 2021
@ilslv
Copy link
Member Author

ilslv commented Aug 25, 2021

FCM

Fix non-deterministic error messages (#2)

@ilslv ilslv requested a review from tyranron August 25, 2021 07:51
@ilslv ilslv self-assigned this Aug 25, 2021
@@ -300,12 +300,16 @@ impl TryFrom<syn::Field> for Field {
};
names.try_merge_self::<kind::Value, dedup::Unique>(attrs.aliases)?;

let mut names =
names.into_iter().map(|n| n.to_string()).collect::<Vec<String>>();
names.sort();
Copy link
Member

Choose a reason for hiding this comment

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

We better use BTreeMap here then, if we need order guarantees.

@tyranron tyranron changed the title Draft: Fix non-deterministic error messages Fix non-deterministic error messages Aug 25, 2021
@tyranron tyranron marked this pull request as ready for review August 25, 2021 09:30
@tyranron tyranron merged commit cb95a53 into master Aug 25, 2021
@tyranron tyranron deleted the non-deterministic-error-messages branch August 25, 2021 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants