google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
27.41k stars 1.63k forks source link

Latest mdbook and mdbook-svgbob are not compatible #1040

Closed star-du closed 1 year ago

star-du commented 1 year ago

I follow the instruction to install mdbook and mdbook-svgbob in README. However, as of today (July 29th), when I run cargo install mdbook mdbook-svgbob, it reports:

error[E0277]: the trait bound `Cfg: From<&toml::map::Map<std::string::String, toml::value::Value>>` is not satisfied
  --> /Users/star/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mdbook-svgbob-0.2.1/src/preprocessor.rs:58:42
   |
58 | ...     .and_then(|map| map.try_into().map_err(|err| error!("{}", err))....
   |                             ^^^^^^^^ the trait `From<&toml::map::Map<std::string::String, toml::value::Value>>` is not implemented for `Cfg`
   |
   = note: required for `&toml::map::Map<std::string::String, toml::value::Value>` to implement `Into<Cfg>`
   = note: required for `Cfg` to implement `TryFrom<&toml::map::Map<std::string::String, toml::value::Value>>`
   = note: required for `&toml::map::Map<std::string::String, toml::value::Value>` to implement `TryInto<Cfg>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `mdbook-svgbob` (bin "mdbook-svgbob") due to previous error
error: failed to compile `mdbook-svgbob v0.2.1`, intermediate artifacts can be found at `/var/folders/v5/36d3013s7f56pv4d4kpftd5c0000gn/T/cargo-install2cKq85`
     Summary Successfully installed mdbook! Failed to install mdbook-svgbob (see error(s) above).
error: some crates failed to install

It seems this version of mdbook-svgbob does not like my mdbook v0.4.32, which is the version in crates.io registry.

I see we are using --locked flag in .github/workflows/install-mdbook/action.yml to specify the desired mdbook version (v0.4.28), which works for me. Should we update the README.md as well, so new users will not be frustrated by similar build failures?

star-du commented 1 year ago

It's also mentioned in another issue in mdbook-svgbob here , but sadly the discussion there was not immediately helpful to me.

mgeisler commented 1 year ago

Hi @star-du,

Thanks for reporting this! The full steps used when publishing new versions are found in install-mdbook/action.yml:

cargo install mdbook --locked --version 0.4.28
cargo install mdbook-svgbob --locked --version 0.2.1
cargo install mdbook-i18n-helpers --locked --version 0.1.0
cargo install --path mdbook-exerciser --locked

I think you've basically discovered that we have a lurking incompatibility between the latest version of mdbook and mdbook-svgbob. We don't notice in CI since we lock the version, but we would definitely need to debug this.

mgeisler commented 1 year ago

I think we're seeing https://github.com/rust-lang/mdBook/issues/2019 again — bumping the toml dependency in mdbook causes the plugins to fail.

mgeisler commented 1 year ago

This was fixed quickly by rolling back the change in mdbook — I just checked and I can compile things fine with mdbook 0.4.34.

star-du commented 1 year ago

Sorry I was out of town last two weeks. Thanks @mgeisler for the response and I'm glad if this issue helps the team : )