error-chain icon indicating copy to clipboard operation
error-chain copied to clipboard

Use Void in __Nonexhaustive

Open hcpl opened this issue 7 years ago • 2 comments

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.

hcpl avatar Nov 01 '17 21:11 hcpl

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.

hcpl avatar Nov 04 '17 13:11 hcpl

Can you help me understand the use case?

AndyGauge avatar Jun 04 '19 04:06 AndyGauge