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

Build error with default-features=false, features = [ "export-dot", "export-plantuml" ] #44

Open
andrew-otiv opened this issue Jun 21, 2023 · 4 comments

Comments

@andrew-otiv
Copy link

When I build with this combination of features:
typestate = {version="0.8.0", default-features=false, features = [ "export-dot", "export-plantuml" ]}

I am hitting:

   Compiling typestate-proc-macro v0.8.0
error[E0412]: cannot find type `IntermediateAutomaton` in this scope
   --> /home/andrew-otiv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/typestate-proc-macro-0.8.0/src/igraph/export.rs:298:32
    |
298 |     impl<S, T> Export<Dot> for IntermediateAutomaton<S, T>
    |                                ^^^^^^^^^^^^^^^^^^^^^ not found in this scope

error[E0308]: mismatched types
   --> /home/andrew-otiv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/typestate-proc-macro-0.8.0/src/lib.rs:188:29
    |
188 |             .export(&mut f, Dot)
    |              ------         ^^^ expected `PlantUml`, found `Dot`
    |              |
    |              arguments to this method are incorrect
    |
note: method defined here
   --> /home/andrew-otiv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/typestate-proc-macro-0.8.0/src/igraph/export.rs:14:8
    |
14  |     fn export<W: std::io::Write>(&self, w: &mut W, _: F) -> Result;
    |        ^^^^^^

I ~think I'm using:

rustc 1.70.0 (90c541806 2023-05-31)

but I'm not entirely certain since I hit this whille messing with build systems that may or may not be setting up their own toolchain behind my back.

I get a clean build with Cargo with all features enabled, in the same environment, leading me to suspect that the issue is specific to this combination of feature flags.

The wider context, if you happen to be interested, is that I'm trying to get a state machine based on typestate-rs to build on buck2 with reindeer, and pruned out the mermaid related dependencies since they had issues (that are probably unrelated).

Thanks for the very neat libary! I'm evaluating it for use in a safety related system, where statically enforced correctness of our state machines would be an attractive feature.

@andrew-otiv
Copy link
Author

Update:
I tried more feature combinations. ["export-dot"] fails, but I get a green build in both cargo and buck2 with just export-plantuml enabled, so that's a temporary workaround if you don't need the dotfiles.

@jmg-duarte
Copy link
Contributor

Hello @andrew-otiv! Thank you for your interest in typestate, currently the crate is pretty much unmaintained but I'd be open to learn more about your use case and how I can help you. If that sounds interesting let me know so we can establish a better communication channel!

@andrew-otiv
Copy link
Author

Thanks! We still have a lot to figure out in the software stack we're building, so it's probably premature to deepen a collaboration, but if we stick with typestate-rs, I'll be providing at minimum bug reports, which I asprire to make high quality. My company develops control and supervision systems for trains and trams, and on some of our projects we have strict functional safety requirements that may preclude even using Rust, let alone a specific library. So for example typestate-rs wasn't developed with processes you have to use for safety critical software in our industry, so instead of arguing for the functional safety of typestate-rs, it may be less work for us to run cargo expand, and then do the functional safety process on that code.

I showed off a typestate-rs based demo to colleagues this morning and they thought it was neat!

@jmg-duarte
Copy link
Contributor

jmg-duarte commented Jul 4, 2023

Sorry for the delayed reply @andrew-otiv

W.r.t. functional safety, you're absolutely right, the crate was not developed with that in mind, but rather as an exploration of typestates in Rust - my MSc thesis topic.

I stopped working on it since there was little incentive to keep going (a lot of stars but little interest in real-life use cases), as it currently stands, I am available to provide help and guidance w.r.t. using the crate, developing it further or even developing a variant yourself.

I've published some work on the topic which you can access in articles/.

You can also take a look into behavioral types as they are actively being worked on by the scientific community.

More resources you might find useful to look into:
https://sites.google.com/view/rustverify2021/home
https://sites.google.com/view/rustverify2022/home
https://sites.google.com/view/rustverify2023/home

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

No branches or pull requests

2 participants