Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Use Void in __Nonexhaustive #237

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

Conversation

hcpl
Copy link

@hcpl hcpl commented Nov 1, 2017

This prevents construction of this variant.

Use a hidden public wrapper over void::Void for 2 reasons:

  • Users shouldn't need to specify a void dependency in Cargo.toml to use error-chain.
  • We can reuse whatever trait impls defined for void::Void.

Alternatively, error-chain can define its own enum Void {} to bring down amount of dependencies (as a rather fundamental crate, more dependencies can lead to issues, in my opinion).

Technically, this is a breaking change because __Nonexhaustive in 0.11.0 can still be used. If compatibility is a concern, void can be made an optional dependency and disabled by default - then 0.11.1 will only add a Cargo feature without breaking changes.

This prevents construction of this variant.
@hcpl
Copy link
Author

hcpl commented Nov 4, 2017

It should be noted that if there is a crate A that depends on error-chain 0.11.1 with the "void" feature enabled and a crate B which depends on the same version with "void" disabled, they are still incompatible. So it might be better to bump to 0.12 after all, since it's a breaking change anyway.

@AndyGauge
Copy link
Contributor

Can you help me understand the use case?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants