Skip to content

Fix serialize feature in rust crate flatbuffers#9096

Open
alexanderkjall wants to merge 1 commit into
google:masterfrom
alexanderkjall:fix-serialize-feature
Open

Fix serialize feature in rust crate flatbuffers#9096
alexanderkjall wants to merge 1 commit into
google:masterfrom
alexanderkjall:fix-serialize-feature

Conversation

@alexanderkjall
Copy link
Copy Markdown

'cargo build --no-default-features --features serialize' fails due to std not being available.

Without this patch:

$ cargo build --no-default-features --features serialize
   Compiling flatbuffers v25.12.19 (/tmp/r/flatbuffers-25.12.19)
error[E0433]: cannot find module or crate `std` in this scope
   --> src/array.rs:152:46
    |
152 |     fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    |                                              ^^^ use of unresolved module or unlinked crate `std`
    |
    = help: if you wanted to use a crate named `std`, use `cargo add std` to add it to your `Cargo.toml`
help: consider importing this module
    |
 17 + use core::result;
    |
help: if you import `result`, refer to it directly
    |
152 -     fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
152 +     fn serialize<S>(&self, serializer: S) -> result::Result<S::Ok, S::Error>
    |

error[E0433]: cannot find module or crate `std` in this scope
   --> src/vector.rs:326:46
    |
326 |     fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    |                                              ^^^ use of unresolved module or unlinked crate `std`
    |
    = help: if you wanted to use a crate named `std`, use `cargo add std` to add it to your `Cargo.toml`
help: consider importing this module
    |
 17 + use core::result;
    |
help: if you import `result`, refer to it directly
    |
326 -     fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
326 +     fn serialize<S>(&self, serializer: S) -> result::Result<S::Ok, S::Error>
    |

For more information about this error, try `rustc --explain E0433`.
error: could not compile `flatbuffers` (lib) due to 2 previous errors

Also some follow-up test fixes to make sure 'cargo build --no-default-features --features serialize' works.

'cargo build --no-default-features --features serialize' fails due to std not being availible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant