not-fl3 / nanoserde

Serialisation library with zero dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

could not find `result` in `core` on deriving DeBin

EriKWDev opened this issue · comments

     |
4946 | #[derive(Debug, Copy, Clone, DeBin, SerBin)]
     |                              ^^^^^ could not find `result` in `core`

Sometimes I get this and it is very frustrating and hard to debug :/

Apparently some other derive macro had this issue reported illicitonion/num_enum#27 but the problem was that the user had created their own crate named core. I have not done so nor do I have any dependencies named core. To my knowledge there are no modules named core either from any of our dependencies, though I don't know how I would debug that.

Any tips on what to do here?

     |
41   | pub fn derive_de_bin(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
     | ------------------------------------------------------------------------------- in this expansion of `#[derive(DeBin)]`
     |
help: consider importing one of these items
     |
1    + use ::core::result;
     |
1    + use std::result;

The suggested help sadly doesn't work :/

Hi, sorry you've encountered this, I will take a look. Are you using the no-std feature by any chance?

No, just the defaults

Could you try building with

[patch.crates-io]
nanoserde = { git = "https://github.com/knickish/nanoserde.git", branch = "fix/missing_core_result"}

in your Cargo.toml and let me know if that fixes it for you?

Does seem to work! I do wonder why using the ::core makes a difference? I've seen it used in other places but never understood why

Yeah I'm not sure what would be interfering with the resolution there, will need to do some reading. Regardless, this is merged now and will be in the next release. Apologies for the difficulties

No need to apologize! Thanks so much for keeping nanoserde up-to-date. Love it