This has me puzzled. I'm building something that uses "handlebars" from within a dependency that's not mine. It's pulling in handlebars 5.1.2, which is current. Fails to compile with error:
error[E0599]: no method named `message` found for enum `ErrorVariant` in the current scope
--> /home/john/.cargo/registry/src/index.crates.io-6f17d22bba15001f/handlebars-5.1.2/src/template.rs:644:27
|
644 | e.variant.message().to_string(),
| ^^^^^^^ method not found in `ErrorVariant<Rule>`
This is a version problem. ErrorVariant is from crate "pest", and only newer versions of ErrorVariant have message()
as a method. In earlier versions, it was a field.
So, time to look at cargo.lock and cargo.toml files.
Version of "handlebars" pulled in is 5.1.2. Current.
Version of "pest" pulled in is "2.1.3". Not current; current in cargo.io is 2.7.9.
Checking "handlebars" Cargo.toml: pest = "2.1.3"
That old version of "pest" doesn't have .message(), so handlebars won't compile.
So far, it just looks like a botched dependency.
So, to reproduce the problem for a bug report, I build "handlebars" from
git clone https://github.com/sunng87/handlebars-rust.git
That builds fine. When I look at its Cargo.lock file, I find
[[package]]
name = "pest"
version = "2.7.9"
Why did Cargo pick that later version, when the Cargo.toml file for "handlebar-rust" has
pest = "2.1.0"
Not seeing any workspace-level files or overrides.