ironthree / dxr

Declarative XML-RPC in Rust
Apache License 2.0
17 stars 8 forks source link

derive: fix compilation error if user define its own Result type #20

Closed abernardeau-wallix closed 4 months ago

abernardeau-wallix commented 4 months ago

When using the TryFromValue and TryToValue macros in a file where a custom Result is defined (in my case type Result<T> = std::result::Result<T, Box<dyn Error + Send + Sync>>;) the macro doesn't work anymore and create a compilation error.

The Result seems to be common pattern and I think it should not break the macrso (https://doc.rust-lang.org/rust-by-example/error/result/result_alias.html )

decathorpe commented 4 months ago

Great, thanks! Let's see what the CI says.

abernardeau-wallix commented 4 months ago

I updated the PR with your wise remarks.

(Imagine somebody redefining std, it would cause the same problem as the custom Result.)

This is a terrifying thought 😱.

abernardeau-wallix commented 4 months ago

It seems that the nightly jobs is failing to the time crate used here not being compatible with the nightly toolchain. Locally running a cargo update seems to be fixing the issue but it updates a bunch of dependencies.

decathorpe commented 4 months ago

Yeah, the failure with time is unrelated. I've pushed a change that updates the lockfile. Once the CI is green here, can you rebase your PR? https://github.com/ironthree/dxr/actions/runs/9905812150

decathorpe commented 4 months ago

Awesome. Thank you for the contribution!

decathorpe commented 4 months ago

Do you need a new release in the v0.6 branch with this fix? Or would it be OK if this just ends up in 0.7.0?

abernardeau-wallix commented 4 months ago

If it's not too much work I would be happy to have a release with the fix but I can implement a workaround in my code and can wait for the 0.7.0 version. Thank you for the nice library and your reactivity.

decathorpe commented 4 months ago

I'm working on some refactors for 0.7.0 still, so I'll cherry-pick your change onto the v0.6 release series and publish a new version.