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

Build error thanks to bitvec vs funty #522

Closed
leehambley opened this issue Jul 31, 2021 · 3 comments · Fixed by #530
Closed

Build error thanks to bitvec vs funty #522

leehambley opened this issue Jul 31, 2021 · 3 comments · Fixed by #530

Comments

@leehambley
Copy link
Contributor

I have a project using askama@0.10.5 and mysql@21.0.0 which leaves me with the following

├── askama v0.10.5
│   ├── askama_derive v0.10.5 (proc-macro)
│   │   ├── askama_shared v0.11.1
│   │   │   ├── askama_escape v0.10.1
│   │   │   ├── humansize v1.1.1
│   │   │   ├── nom v6.1.1
│   │   │   │   ├── bitvec v0.19.4
│   │   │   │   │   ├── funty v1.2.0
│   │   │   │   │   ├── radium v0.5.3
│   │   │   │   │   ├── tap v1.0.1
│   │   │   │   │   └── wyz v0.2.0
│   │   │   │   ├── lexical-core v0.7.5
│   │   │   │   │   ├── arrayvec v0.5.2
│   │   │   │   │   ├── bitflags v1.2.1
│   │   │   │   │   ├── cfg-if v1.0.0
│   │   │   │   │   ├── ryu v1.0.5
│   │   │   │   │   └── static_assertions v1.1.0
│   │   │   │   └── memchr v2.3.4
│   │   │   │   [build-dependencies]
│   │   │   │   └── version_check v0.9.2
│   │   │   ├── num-traits v0.2.14
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.0.1
│   │   │   ├── percent-encoding v2.1.0
│   │   │   ├── proc-macro2 v1.0.24 (*)
│   │   │   ├── quote v1.0.9 (*)
│   │   │   ├── serde v1.0.124 (*)
│   │   │   ├── syn v1.0.61 (*)
│   │   │   └── toml v0.5.8
│   │   │       └── serde v1.0.124 (*)
│   │   ├── proc-macro2 v1.0.24 (*)
│   │   └── syn v1.0.61 (*)
│   ├── askama_escape v0.10.1
│   └── askama_shared v0.11.1 (*)
├── askama_derive v0.10.5 (proc-macro) (*)
├── askama_shared v0.11.1 (*)

The key thing (if I understood this) is that here we have bitvec@0.19.4.

Elsewhere in my dependency tree I have:

│   ├── mysql_common v0.27.4
│   │   ├── base64 v0.13.0
│   │   ├── bigdecimal v0.2.0
│   │   │   ├── num-bigint v0.3.2
│   │   │   │   ├── num-integer v0.1.44 (*)
│   │   │   │   └── num-traits v0.2.14 (*)
│   │   │   │   [build-dependencies]
│   │   │   │   └── autocfg v1.0.1
│   │   │   ├── num-integer v0.1.44 (*)
│   │   │   ├── num-traits v0.2.14 (*)
│   │   │   └── serde v1.0.124 (*)
│   │   ├── bitflags v1.2.1
│   │   ├── bitvec v0.22.3
│   │   │   ├── funty v1.2.0
│   │   │   ├── radium v0.6.2
│   │   │   ├── tap v1.0.1
│   │   │   └── wyz v0.4.0
│   │   │       └── tap v1.0.1
│   │   ├── byteorder v1.4.2
│   │   ├── bytes v1.0.1
│   │   ├── chrono v0.4.19 (*)

bitvec@0.22.3 and funty@1.2.0 work well enough together as evidenced by a min project I put together with just the two of them, but the build specifically mentions 0.19.4:

error[E0034]: multiple applicable items in scope
   --> /home/leeh/.asdf/installs/rust/1.53.0/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/order.rs:315:15
    |
315 |         if ct == R::BITS {
    |                     ^^^^ multiple `BITS` found
    |
note: candidate #1 is defined in the trait `BitMemory`
   --> /home/leeh/.asdf/installs/rust/1.53.0/registry/src/github.com-1ecc6299db9ec823/bitvec-0.19.4/src/mem.rs:29:2
    |
29  |     const BITS: u8 = mem::size_of::<Self>() as u8 * 8;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in the trait `IsNumber`
   --> /home/leeh/.asdf/installs/rust/1.53.0/registry/src/github.com-1ecc6299db9ec823/funty-1.2.0/src/lib.rs:144:2
    |
144 |     const BITS: u32;
    |     ^^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #1
    |
315 |         if ct == BitMemory::BITS {
    |                  ^^^^^^^^^^^^^^^
help: disambiguate the associated constant for candidate #2
    |
315 |         if ct == IsNumber::BITS {
    |                  ^^^^^^^^^^^^^^

error: aborting due to 43 previous errors

Some errors have detailed explanations: E0034, E0308.
For more information about an error, try `rustc --explain E0034`.
error: could not compile `bitvec`

I reported it here because we have here in askama as nom@6.1.1 as a dependency is inherited here.

nom@6.2.1 has a fix, apparently which allows newer versions of bitvec rust-bakery/nom#1311 (comment)

I tried in a small patch, something like:

diff --git a/askama_shared/Cargo.toml b/askama_shared/Cargo.toml
index e341b2e..95775e4 100644
--- a/askama_shared/Cargo.toml
+++ b/askama_shared/Cargo.toml
@@ -19,8 +19,8 @@ yaml = ["serde", "serde_yaml"]
 [dependencies]
 askama_escape = { version = "0.10", path = "../askama_escape" }
 humansize = { version = "1.1.0", optional = true }
-funty = "=1.1.0" # Temporary fix for bitvec, remove once fixed. (https://github.com/bitvecto-rs/bitvec/issues/105)
-nom = { version = "6", features = ["std"], default-features = false }
+funty = "=1.1.0"
+nom = { version = "6.2.1", features = ["std"], default-features = false }
 num-traits = { version = "0.2.6", optional = true }
 proc-macro2 = "1"
 quote = "1"

This seems to work locally, and cargo clean && cargo test seems to be ✔️ - I'd be happy to send a PR for that, and bumping version numbers and the release notes/etc. Please just let me know. I'm switching my project to my own git fork of askama and check if it's working.

@djc
Copy link
Collaborator

djc commented Jul 31, 2021

Should keep the comment as there is really no good reason for Askama to depend on funty, but would otherwise be happy to take a PR! I've been pushing on the nom side to fix the situation there but it doesn't look like there'll be much progress soon.

@leehambley
Copy link
Contributor Author

Thanks @djc - I've send a patch.

@Geal
Copy link

Geal commented Aug 21, 2021

you can now use nom 7, which fixes the issues with bitvec

@djc djc mentioned this issue Aug 21, 2021
@djc djc closed this as completed in #530 Aug 21, 2021
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

Successfully merging a pull request may close this issue.

3 participants