danieleades / mdbook-d2

D2 diagram generator plugin for MdBook
MIT License
26 stars 8 forks source link

cargo install broken on latest release #22

Closed mrpatrickpilch closed 1 year ago

mrpatrickpilch commented 1 year ago

rustc & cargo version is 1.65.0

$ cargo install mdbook-d2
....
   Compiling toml v0.5.11
   Compiling mdbook-d2 v0.2.0
error[E0277]: the trait bound `Value: From<toml::map::Map<std::string::String, toml::value::Value>>` is not satisfied
  --> /Users/patrickpilch/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-d2-0.2.0/src/backend.rs:69:34
   |
69 |         let value: toml::Value = ctx.config.get_preprocessor("d2").unwrap().clone().into();
   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---- required by a bound introduced by this call
   |                                  |
   |                                  the trait `From<toml::map::Map<std::string::String, toml::value::Value>>` is not implemented for `Value`
   |
   = help: the following other types implement trait `From<T>`:
             <Value as From<&'a str>>
             <Value as From<BTreeMap<S, V>>>
             <Value as From<HashMap<S, V>>>
             <Value as From<Vec<V>>>
             <Value as From<bool>>
             <Value as From<f32>>
             <Value as From<f64>>
             <Value as From<i32>>
           and 7 others
   = note: required for `toml::map::Map<std::string::String, toml::value::Value>` to implement `Into<Value>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `mdbook-d2` due to previous error
warning: build failed, waiting for other jobs to finish...
danieleades commented 1 year ago

MdBook has just made a breaking change with a patch semver bump... I should know, i submitted the PR - https://github.com/rust-lang/mdBook/pull/2009

this plugin and mdbook are therefore using conflicting versions of the toml library.

you can use the tested version by having cargo install respect the lockfile committed in this repo-

cargo install mdbook-d2 --locked

(it's not a bad rule of thumb to use that for most binaries)

I'll also get a patch out to bump the toml dependency in this plugin to match