[Solved] Rust libcore/result.rs system file paniced

This seems coming from system lib by using set_panic_hook tool on my rust program. I have no further idea. Please comment.

ERROR: Panicked at 'called Result::unwrap() on an Err value: TypeMismatch { expected: "String", actual: "Reference" }', src/libcore/result.rs:1009:5


1 Like

Can you please post the relevant code, as in where it panicked in your code?

It's unfortunate that Option and Result::unwrap() report their panic location at their implementation in the standard library, but this is an artifact of being plain code to the compiler, not treated in any special way. It might not even be the immediate caller which is interesting to you anyway. You can set RUST_BACKTRACE=1 in the environment to see how you got to that failed unwrap.


Thanks guys. That is what I guessed. As the reported panic location/function, whose code never executed.
I have bypassed the issue. I tried to use javascript promise and stdweb to do ordering of rust calls in react, but I think the failure was due to the return from rust functions are either none or not a promise.
I have changed ordering strategy to using react lifecycles and setState method and the issue disappeared.
Thanks again.
Happy coding and New Year.