-
Notifications
You must be signed in to change notification settings - Fork 21
Description
I am trying to set up a project using the robusta_jni crate, and today I started seeing a weird issue where the pub keyword in my "jni" (implemented on the rust side of the program) function causes a compiler error. The rust diagnostic looks like this:
error[E0599]: no method named `description` found for enum `robusta_jni::jni::errors::Error` in the current scope
--> src\lib.rs:13:9
|
13 | pub extern "jni" fn printFromRust() -> JniResult<()> {
| ^^^ method not found in `Error`
|
::: C:\Users\MY_NAME\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\error.rs:110:8
|
110 | fn description(&self) -> &str {
| ----------- the method is available for `robusta_jni::jni::errors::Error` here
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
5 + use std::error::Error;
|
Meanwhile, the code that's causing the error is very simple (because I'm just trying to make sure everything works at this point). The file it's in doesn't even use robusta_jni::jni::errors::Error.
...
pub extern "jni" fn printFromRust() -> JniResult<()> {
println!("Rust called from Java.");
Ok(())
}
Adding the use statement like the diagnostic suggests turns the error into a warning about the description method being deprecated, and this may be what I have to do for now to get the code to build.
I also tried copying and pasting the example code from this GitHub repo into the file and all of the "jni" functions in that code had the exact same issue, which is why I think it may be a bug in the robusta_jni crate. The last time the code didn't have this issue was before Rust 1.70 was released, so maybe that update broke something,