ltabis / rhai-autodocs

Generate Markdown documentation from a `rhai::Engine` instance.
MIT License
3 stars 1 forks source link

rhai-autodocs fails to compile if rhai is using the no_float feature flag #29

Closed VorpalBlade closed 4 months ago

VorpalBlade commented 4 months ago

If you use rhai with no_float, then rhai-autodocs doesn't build. Due to feature unification I don't think there is a way around this. Probably rhai-autodocs also need a no_float flag and to disable that float code if rhai is built without it?

error[E0412]: cannot find type `FLOAT` in crate `rhai`
   --> /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rhai-autodocs-0.6.1/src/function.rs:67:53
    |
67  |     let ty = ty.replace(std::any::type_name::<rhai::FLOAT>(), "float");
    |                                                     ^^^^^ not found in `rhai`
    |
note: found an item that was configured out
   --> /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rhai-1.19.0/src/lib.rs:198:10
    |
198 | pub type FLOAT = f64;
    |          ^^^^^
note: found an item that was configured out
   --> /home/arvid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rhai-1.19.0/src/lib.rs:208:10
    |
208 | pub type FLOAT = f32;
    |          ^^^^^

For more information about this error, try `rustc --explain E0412`.
error: could not compile `rhai-autodocs` (lib) due to 1 previous error
ltabis commented 4 months ago

Hi @VorpalBlade, thank you for the report. Mirroring Rhai's feature flag seems reasonable to me, so I made a quick PR here https://github.com/ltabis/rhai-autodocs/pull/30. I tested it on my end and it seems to work fine, but I would encourage you to try it with your code.

VorpalBlade commented 4 months ago

I seem unable to test it. Usually the following works:

[patch.crates-io]
rhai-autodocs = { git = "https://github.com/ltabis/rhai-autodocs.git", branch = "fix/feature_flags#29" }

I suspect cargo gets confused by the #? I tested url-encoding it as well to no avail.

VorpalBlade commented 4 months ago

I cloned it and used a path override instead, this seems to have worked. Build and behaviour seems to work fine. Thanks!

ltabis commented 4 months ago

You can use rhai-autodocs 0.6.2 now https://github.com/ltabis/rhai-autodocs/releases/tag/v0.6.2