Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump binrw to 0.11 on mcap rust bindings #901

Open
therishidesai opened this issue May 30, 2023 · 6 comments
Open

bump binrw to 0.11 on mcap rust bindings #901

therishidesai opened this issue May 30, 2023 · 6 comments

Comments

@therishidesai
Copy link

therishidesai commented May 30, 2023

When using the latest versions of binrw the mcap rust bindings fail to build with the following error:

121 |     fn read_le<T: BinRead>(&mut self) -> BinResult<T>
    |                   ^^^^^^^ required by this bound in `BinReaderExt::read_le`

error[E0277]: the trait bound `MessageHeader: binrw::BinRead` is not satisfied
   --> /home/rishi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mcap-0.6.0/src/read.rs:423:74
    |
423 |             let header: records::MessageHeader = Cursor::new(header_buf).read_le()?;
    |                                                                          ^^^^^^^ the trait `binrw::BinRead` is not implemented for `MessageHeader`
    |
    = help: the following other types implement trait `binrw::BinRead`:
              ()
              (b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
              (b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32)
            and 46 others
note: required by a bound in `read_le`
   --> /home/rishi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/binrw-0.9.2/src/binread/mod.rs:121:19
    |
121 |     fn read_le<T: BinRead>(&mut self) -> BinResult<T>
    |                   ^^^^^^^ required by this bound in `BinReaderExt::read_le`

error[E0433]: failed to resolve: use of undeclared type `McapString`
   --> /home/rishi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mcap-0.6.0/src/records.rs:212:17
    |
212 |         let k = McapString::read_options(reader, ro, args)?;
    |                 ^^^^^^^^^^ use of undeclared type `McapString`

error[E0433]: failed to resolve: use of undeclared type `McapString`
   --> /home/rishi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mcap-0.6.0/src/records.rs:213:17
    |
213 |         let v = McapString::read_options(reader, ro, args)?;
    |                 ^^^^^^^^^^ use of undeclared type `McapString`
  • Version:
  • Platform:

Steps To Reproduce

cd mcap/rust
cargo run --example mcapcat

Expected Behavior

@therishidesai therishidesai added the bug Something isn't working label May 30, 2023
@foxhubber
Copy link

foxhubber bot commented May 30, 2023

Internal tracking ticket: FG-3730

@therishidesai
Copy link
Author

Here are some more error messages related to this:

error: custom attribute panicked
   --> src/records.rs:105:1
    |
105 | #[binrw]
    | ^^^^^^^^
    |
    = help: message: attempt to subtract with overflow

error: proc-macro derive panicked
   --> src/records.rs:169:39
    |
169 | #[derive(Debug, Clone, Eq, PartialEq, BinRead, BinWrite)]
    |                                       ^^^^^^^
    |
    = help: message: attempt to subtract with overflow

It looks like the updates to the syn crate is causing binrw to panic

@therishidesai
Copy link
Author

bumping the binrw version to 0.11.2 fixes these errors but now I get the following errors:

error[E0412]: cannot find type `ReadOptions` in this scope
   --> src/records.rs:131:10
    |
131 |     ro: &ReadOptions,
    |          ^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `WriteOptions` in this scope
   --> src/records.rs:151:12
    |
151 |     opts: &WriteOptions,
    |            ^^^^^^^^^^^^ not found in this scope
    |
help: consider importing this struct
error[E0107]: missing generics for associated type `binrw::BinRead::Args`
   --> src/records.rs:129:32
    |
129 | fn parse_vec<T: binrw::BinRead<Args = ()>, R: Read + Seek>(
    |                                ^^^^ expected 1 lifetime argument
    |
note: associated type defined here, with 1 lifetime parameter: `'a`
   --> /home/rishi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/binrw-0.11.2/src/binread/mod.rs:49:10
    |
49  |     type Args<'a>;
    |          ^^^^ --
help: add missing lifetime argument
    |
129 | fn parse_vec<T: binrw::BinRead<Args<'a> = ()>, R: Read + Seek>(

@james-rms
Copy link
Collaborator

I don't think there's a complete set of steps to reproduce here, at least when I run

cd mcap/rust
cargo run --example mcapcat

on the latest main I don't see any build errors. we also run full builds and tests in CI on every commit, so i would expect to have caught this issue there.

Cargo.toml specifies binrw = "0.9", which is what I would expect to work here. Have you modified cargo.toml in your source tree?

@therishidesai
Copy link
Author

These errors are happening with the nightly toolchain. Going to change this issue into a feature request to bump binrw to 0.11

@therishidesai therishidesai changed the title mcap rust bindings fail to build due to binrw errors bump binrw to 0.11 on mcap rust bindings May 30, 2023
@defunctzombie defunctzombie removed the bug Something isn't working label Jun 2, 2023
@defunctzombie
Copy link
Contributor

We'd welcome a PR for this and some testing showing it is working but don't have the capacity to get to this ourselves right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants