cursive
cursive copied to clipboard
Can't compile... EnumSetType not found
Just asking for help, I am pretty sure I just messed up / forgot something... New to rust and to cursive..
Problem description
Can't compile the simplest example Cargo.toml:
[dependencies]
cursive = "*"
main.rs:
use cursive::views::{Dialog, TextView};
fn main() {
let mut siv = cursive::default();
siv.add_layer(Dialog::around(TextView::new("Hello Dialog!"))
.title("Cursive")
.button("Quit", |s| s.quit()));
siv.run();
}
Error:
/home/denis/.cargo/bin/cargo build --color=always --package tui-app --bin tui-app --message-format=json-diagnostic-rendered-ansi
Compiling cursive_core v0.1.2
error[E0412]: cannot find type `EnumSet` in this scope
--> /home/denis/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive_core-0.1.2/src/theme/effect.rs:4:10
|
4 | #[derive(EnumSetType, Debug)]
| ^^^^^^^^^^^ not found in this scope
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
1 | use crate::printer::EnumSet;
|
1 | use enumset::EnumSet;
|
error[E0422]: cannot find struct, variant or union type `EnumSet` in this scope
--> /home/denis/.cargo/registry/src/github.com-1ecc6299db9ec823/cursive_core-0.1.2/src/theme/effect.rs:4:10
|
4 | #[derive(EnumSetType, Debug)]
| ^^^^^^^^^^^ not found in this scope
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
1 | use crate::printer::EnumSet;
|
1 | use enumset::EnumSet;
|
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0412, E0422.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `cursive_core`
Environment
~$ rustc --version
rustc 1.49.0 (e1884a8e3 2020-12-29)
~$ uname -r
5.9.0-0.bpo.5-amd64
Hi, and thanks for the report!
Cursive 0.15 depends on the enumset crate, which went through a few hard times:
- First, it relied on a non-public API of its
syndependency, which broke builds for a while. - Then, it fixed the issue but brought non-compatible changes in the same major version.
As a result, "old" versions of cursive like 0.15 try to use the latest version of enumset but compilation fails because of these changes.
The current solution is to update cursive to the latest 0.16 version (which currently replaces enumset with wasmer_enumset).
I confirm using 0.16 solves the problem! Thanks:)