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

Doesn't build with nightly #405

Closed
johnrichardrinehart opened this issue May 16, 2023 · 2 comments
Closed

Doesn't build with nightly #405

johnrichardrinehart opened this issue May 16, 2023 · 2 comments

Comments

@johnrichardrinehart
Copy link

johnrichardrinehart commented May 16, 2023

Description

$ rustc --version                                                                       
rustc 1.71.0-nightly (ce5919fce 2023-05-15)
$ cargo --version      
cargo 1.71.0-nightly (13413c64f 2023-05-10)
error[E0277]: cannot multiply `u64` by `NonZeroU8`
    --> /home/john/.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)

note: erroneous constant used
    --> /home/john/.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/john/.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/john/.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)

Update: Some Cargo.toml hacking on my end fixed this. For nightly users, it'd be nice if a new release could be cut. It looks like it should ameliorate this.

For future readers: I had to add

mp4parse = "0.12.0"

and

[patch.crates-io]
mp4parse = { path = "/some/dir/code/repos/forks/mp4parse-rust/mp4parse" }

to my Cargo.toml as an explicit dependency (this crate is only a transitive (grandchild) dependency for my project). Then, I had to patch this repo:

diff --git a/mp4parse/Cargo.toml b/mp4parse/Cargo.toml
index 05086a0..b950f9e 100644
--- a/mp4parse/Cargo.toml
+++ b/mp4parse/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "mp4parse"
-version = "0.17.0"
+version = "0.12.0"
 authors = [
   "Ralph Giles <[email protected]>",
   "Matthew Gregan <[email protected]>",
@fintelia
Copy link

The crates.io version doesn't compile on beta and will also break on stable once rustc 1.70 is released.

The underlying rustc change seems to be rust-lang/rust#89065. It should be fixed by the patch in #376, but no version of mp4parse has been published to crates.io since that was merged.

@johnrichardrinehart
Copy link
Author

Ah, you're right. Thanks for linking that. I can confirm that 8d58b2d (merged a long time ago) fixes the nightly build.

llewelld added a commit to llewelld/gecko-dev-mirror that referenced this issue Aug 22, 2024
Allows building mp4parse-rust with our version of Rust.

See:
1. mozilla/mp4parse-rust#405
2. mozilla/mp4parse-rust#376
3. mozilla/mp4parse-rust@8d58b2d

Applies the following commit from upstream mozilla/mp4parse-rust project:

commit 8d58b2d5fc7f552d585964354d8269bcca3d9251
Author: Matthew Gregan <[email protected]>
Date:   Thu Jun 16 13:54:02 2022 +1200

    Fix `unstable-name-collisions` warning by using fully qualified path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants