jhspetersson / fselect

Find files with SQL-like queries
https://fselect.rocks
Apache License 2.0
4.02k stars 85 forks source link

[Build fail] mp4parse now will cause 'error[E0277]: cannot multiply `u64` by `NonZeroU8`' #131

Closed tan-wei closed 1 year ago

tan-wei commented 1 year ago

Now I can confirm that mp4parse 0.12.0 does not compile, and the latest version in repo is 0.17.0, which is OK. But the latest release version is 0.12.0. So how should I make fselect compile? Thanks!

jhspetersson commented 1 year ago

Hi, just checked that fselect compiles successfully on Ubuntu 22 LTS and Win11. What's your OS/compiler/Rust version?

Please make sure that you use the latest version of Rust:

rustup update

As for mp4parse, there are no plans to vendor the latest 0.17.0 version, I guess fselect will stick to the latest release version of that.

tan-wei commented 1 year ago

Sorry for not giving the compile environment. For me, I use:

Both cargo install select and cargo install --git https://github.com/jhspetersson/fselect.git will cause the same error. And i can confirm that mp4parse 0.12.0 could not be compiled, but not 0.17.0.

tan-wei commented 1 year ago

The error message would be:

   ...
   Compiling chrono-english v0.1.7
   Compiling mp4parse v0.12.0
error[E0277]: cannot multiply `u64` by `NonZeroU8`
    --> /home/winterreise/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mp4parse-0.12.0/src/lib.rs:2547:62
     |
2547 |                 static_assertions::const_assert!(<$lhs>::MAX * <$rhs>::MAX <= <$output>::MAX);
     |                                                              ^ no implementation for `u64 * NonZeroU8`
...
2557 | impl_mul!((U8, std::num::NonZeroU8) => (U16, u16));
     | -------------------------------------------------- in this macro invocation
     |
     = help: the trait `Mul<NonZeroU8>` is not implemented for `u64`
     = help: the following other types implement trait `Mul<Rhs>`:
               <&'a u64 as Mul<u64>>
               <&u64 as Mul<&u64>>
               <u64 as Mul<&u64>>
               <u64 as Mul>
     = note: this error originates in the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)

   Compiling csv v1.2.1
note: erroneous constant used
    --> /home/winterreise/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mp4parse-0.12.0/src/lib.rs:2557:1
     |
2557 | impl_mul!((U8, std::num::NonZeroU8) => (U16, u16));
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this note originates in the macro `static_assertions::const_assert` which comes from the expansion of the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: cannot multiply `u64` by `NonZeroU8`
    --> /home/winterreise/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mp4parse-0.12.0/src/lib.rs:2547:62
     |
2547 |                 static_assertions::const_assert!(<$lhs>::MAX * <$rhs>::MAX <= <$output>::MAX);
     |                                                              ^ no implementation for `u64 * NonZeroU8`
...
2558 | impl_mul!((U32, std::num::NonZeroU8) => (U32MulU8, u64));
     | -------------------------------------------------------- in this macro invocation
     |
     = help: the trait `Mul<NonZeroU8>` is not implemented for `u64`
     = help: the following other types implement trait `Mul<Rhs>`:
               <&'a u64 as Mul<u64>>
               <&u64 as Mul<&u64>>
               <u64 as Mul<&u64>>
               <u64 as Mul>
     = note: this error originates in the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)

note: erroneous constant used
    --> /home/winterreise/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mp4parse-0.12.0/src/lib.rs:2558:1
     |
2558 | impl_mul!((U32, std::num::NonZeroU8) => (U32MulU8, u64));
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: this note originates in the macro `static_assertions::const_assert` which comes from the expansion of the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `mp4parse` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `fselect v0.8.2 (https://github.com/jhspetersson/fselect.git#0ed03864)`, intermediate artifacts can be found at `/tmp/cargo-installRwSv9L`
jhspetersson commented 1 year ago

Oh, I see, indeed, fselect fails to compile on Rust nightly. And not only that crate has this problem. So for now I can suggest switch to stabe:

rustup default stable

and build the project that way.

Thank you very much for the issue! It actually is a warning :) I might have to exclude mp4parse and other crates if they keep breaking with the future versions of Rust...

tan-wei commented 1 year ago

OK, it is the reason indeed. Thanks, I've successfully built. Thus the issue should be closed.