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

Hide helper traits from calling code #7

Merged
merged 4 commits into from
Nov 10, 2019
Merged

Conversation

mystor
Copy link
Contributor

@mystor mystor commented Nov 9, 2019

Changes the name of the Display trait method to reduce the chance that an inherent method conflicts with the type in question, and wraps the helper trait and declarations into an anonymous const context, meaning the helper traits aren't visible to the calling context.

Makes a couple of changes to avoid helper traits from appearing anywhere in the
caller code.

It changes the name of the `Display` trait method to reduce the chance that an
inherent method conflicts with the type in question, causing undesirable
results. It also wraps the helper trait and declarations into an anonymous const
context, meaning the helper traits aren't visible to the calling context.
@mystor
Copy link
Contributor Author

mystor commented Nov 9, 2019

I didn't realize that this crate has a minimum supported rustc version of 1.31. The anonymous const _ wasn't stabilized until 1.37 in rust-lang/rust#61347, meaning that this PR will break on earlier rustc versions.

If we want to continue to support earlier rustc versions, we'll need to take a similar approach to serde_derive, and define an ID for the const based on the type being implemented.

FYI, it appears as though CI isn't currently set to run on PRs, only on pushes, so this PR isn't noted as failing despite the minimum version being tested.

@yaahc
Copy link
Owner

yaahc commented Nov 9, 2019

Ill set it up to run on prs, I think I'd prefer to keep supporting 1.31 but I'm open to bumping the MSRV

@yaahc yaahc merged commit 26010eb into yaahc:master Nov 10, 2019
@mystor mystor deleted the hide_helpers branch November 10, 2019 00:36
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