tommilligan / mdbook-admonish

A preprocessor for mdbook to add Material Design admonishments.
MIT License
176 stars 20 forks source link

Cannot compile #114

Closed h3x4d3c1m4l closed 1 year ago

h3x4d3c1m4l commented 1 year ago

Hi! Unfortunately I can't get 0.10.0 and 0.10.1 to compile. The same error shows up on both Windows as well as macOS with the latest Rust version (1.71.1).

   Compiling mdbook v0.4.33
   Compiling mdbook-admonish v1.10.1
error[E0308]: mismatched types
  --> /Users/sander/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mdbook-admonish-1.10.1/src/book_config.rs:9:30
   |
9  |       let table: toml::Table = ctx
   |  ________________-----------___^
   | |                |
   | |                expected due to this
10 | |         .config
11 | |         .get_preprocessor("admonish")
12 | |         .context("No configuration for mdbook-admonish in book.toml")?
13 | |         .to_owned();
   | |___________________^ expected `Map<String, Value>`, found a different `Map<String, Value>`
   |
   = note: `Map<String, Value>` and `Map<String, Value>` have similar names, but are actually distinct types
note: `Map<String, Value>` is defined in crate `toml`
  --> /Users/sander/.cargo/registry/src/index.crates.io-6f17d22bba15001f/toml-0.5.11/src/map.rs:32:1
   |
32 | pub struct Map<K, V> {
   | ^^^^^^^^^^^^^^^^^^^^
note: `Map<String, Value>` is defined in crate `toml`
  --> /Users/sander/.cargo/registry/src/index.crates.io-6f17d22bba15001f/toml-0.7.6/src/map.rs:32:1
   |
32 | pub struct Map<K, V> {
   | ^^^^^^^^^^^^^^^^^^^^
   = 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-admonish` (lib) due to previous error
error: failed to compile `mdbook-admonish v1.10.1`, intermediate artifacts can be found at `/var/folders/1t/pcxhs0r11zjb8_l47w6wrzwh0000gn/T/cargo-install9dd3kl`
tommilligan commented 1 year ago

Thanks for reporting. Could you share the exact command you run to see this error?

The cause is definitely perhaps two different versions of cratetomlare being used?, which points to either you needing to install with cargo install mdbook-admonish --locked or fixing your Cargo.toml if installing as a library.

Either way knowing your exact command would be useful for me to fix/clarify this for others 🙂

h3x4d3c1m4l commented 1 year ago

cargo install mdbook-admonish. Will try with --locked!

EDIT: works fine, thanks!!

tommilligan commented 1 year ago

Yep, so I think this is an unintentional breaking change in mdbook:

Looks to be being reverted, and the install can be mitigated with --locked, so closing as no further action required.

tommilligan commented 1 year ago

Should be mitigated fully now by https://github.com/tommilligan/mdbook-admonish/pull/115 and released in 1.10.2