Error when trying to enable `mlua`
SCJangra opened this issue · 4 comments
Hey, I am getting the following error when trying to enable mlua
❯ cargo build
Compiling mlua v0.8.5
Compiling nvim-api v0.2.0 (https://github.com/noib3/nvim-oxi.git#29bdd338)
error: You must enable one of the features: lua54, lua53, lua52, lua51, luajit, luajit52, luau
--> /home/scj/.cargo/registry/src/github.com-1ecc6299db9ec823/mlua-0.8.5/build/main.rs:52:5
|
52 | / compile_error!(
53 | | "You must enable one of the features: lua54, lua53, lua52, lua51, luajit, luajit52, luau"
54 | | );
| |_____^
How to reproduce?
- Create a new library project
- Add dependency
nvim-oxi = { version = "0.2", features = ["neovim-0-8", "mlua"]}
- Add in
lib.rs
use nvim_oxi::Result;
#[nvim_oxi::module]
fn nvim_test() -> Result<()> {
Ok(())
}
- run
cargo build
You can fix this by adding mlua with one of the features:
e.g. cargo add mlua -F luajit
@ModProg Yes, I already know that. But if a library exposes some functionality from one of its dependencies, then the user shouldn't need to add that dependency themselves. I mean the user doesn't know what version of the dependency the library uses or what features are enabled (unless they check the source code of course).
@ModProg Yes, I already know that. But if a library exposes some functionality from one of its dependencies, then the user shouldn't need to add that dependency themselves. I mean the user doesn't know what version of the dependency the library uses or what features are enabled (unless they check the source code of course).
Well, clearly none of them, otherwise the error wouldn't occur.
I think in cases where the user might want to select a specific version for themselves, it makes sense to not pre-select one as a library (as rust features are additive), but in this case it would probably make sense to select a Lua version anyway, as Neovim using luajit IIRC so that would always be the one you'd want.