Unable to build due to mismatched types #13

Closed
opened 2023-02-10 10:09:55 +00:00 by joepio · 0 comments
joepio commented 2023-02-10 10:09:55 +00:00 (Migrated from github.com)

Hi there! My CI was failing because there's a type issue.

cargo install mdbook-open-on-gh points to toml versions:

   Compiling mdbook v0.4.26
   Compiling mdbook-open-on-gh v2.3.1
error[E0308]: mismatched types
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:27:13
   |
26 |         let repository_url = match repository_url {
   |                                    -------------- this expression has type `&toml::value::Value`
27 |             toml::Value::String(s) => s,
   |             ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value`
   |
   = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types
note: enum `Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1
   |
22 | pub enum Value {
   | ^^^^^^^^^^^^^^
note: enum `toml::value::Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1
   |
25 | pub enum Value {
   | ^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `toml` are being used?

error[E0308]: mismatched types
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:38:18
   |
36 |         let branch = match ctx.config.get("output.html.git-branch") {
   |                            ---------------------------------------- this expression has type `Option<&toml::value::Value>`
37 |             None => "main",
38 |             Some(toml::Value::String(b)) => b,
   |                  ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value`
   |
   = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types
note: enum `Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1
   |
22 | pub enum Value {
   | ^^^^^^^^^^^^^^
note: enum `toml::value::Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1
   |
25 | pub enum Value {
   | ^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `toml` are being used?

error[E0308]: mismatched types
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:45:18
   |
43 |         let open_on_text = match ctx.config.get("output.html.open-on-text") {
   |                                  ------------------------------------------ this expression has type `Option<&toml::value::Value>`
44 |             None => "Found a bug? [Edit this page on GitHub.]",
45 |             Some(toml::Value::String(b)) => b,
   |                  ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value`
   |
   = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types
note: enum `Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1
   |
22 | pub enum Value {
   | ^^^^^^^^^^^^^^
note: enum `toml::value::Value` is defined in crate `toml`
  --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1
   |
25 | pub enum Value {
   | ^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `toml` are being used?

For more information about this error, try `rustc --explain E0308`.
error: could not compile `mdbook-open-on-gh` due to 3 previous errors
error: failed to compile `mdbook-open-on-gh v2.3.1`, intermediate artifacts can be found at `/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/cargo-installJusROV`
Hi there! My CI was failing because there's a type issue. `cargo install mdbook-open-on-gh` points to toml versions: ``` Compiling mdbook v0.4.26 Compiling mdbook-open-on-gh v2.3.1 error[E0308]: mismatched types --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:27:13 | 26 | let repository_url = match repository_url { | -------------- this expression has type `&toml::value::Value` 27 | toml::Value::String(s) => s, | ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value` | = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types note: enum `Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1 | 22 | pub enum Value { | ^^^^^^^^^^^^^^ note: enum `toml::value::Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1 | 25 | pub enum Value { | ^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `toml` are being used? error[E0308]: mismatched types --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:38:18 | 36 | let branch = match ctx.config.get("output.html.git-branch") { | ---------------------------------------- this expression has type `Option<&toml::value::Value>` 37 | None => "main", 38 | Some(toml::Value::String(b)) => b, | ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value` | = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types note: enum `Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1 | 22 | pub enum Value { | ^^^^^^^^^^^^^^ note: enum `toml::value::Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1 | 25 | pub enum Value { | ^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `toml` are being used? error[E0308]: mismatched types --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-open-on-gh-2.3.1/src/lib.rs:45:18 | 43 | let open_on_text = match ctx.config.get("output.html.open-on-text") { | ------------------------------------------ this expression has type `Option<&toml::value::Value>` 44 | None => "Found a bug? [Edit this page on GitHub.]", 45 | Some(toml::Value::String(b)) => b, | ^^^^^^^^^^^^^^^^^^^^^^ expected enum `toml::value::Value`, found enum `Value` | = note: enum `Value` and enum `toml::value::Value` have similar names, but are actually distinct types note: enum `Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.5.11/src/value.rs:22:1 | 22 | pub enum Value { | ^^^^^^^^^^^^^^ note: enum `toml::value::Value` is defined in crate `toml` --> /Users/joep/.cargo/registry/src/github.com-1ecc6299db9ec823/toml-0.7.2/src/value.rs:25:1 | 25 | pub enum Value { | ^^^^^^^^^^^^^^ = note: perhaps two different versions of crate `toml` are being used? For more information about this error, try `rustc --explain E0308`. error: could not compile `mdbook-open-on-gh` due to 3 previous errors error: failed to compile `mdbook-open-on-gh v2.3.1`, intermediate artifacts can be found at `/var/folders/k1/tynj2xbn5nd12wm5qn3sc4600000gn/T/cargo-installJusROV` ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jer/mdbook-open-on-gh#13
No description provided.