Get cfviz to build again (was broken by new major versions of `clap` crate being released)

Issue #34 resolved
Botond Ballo repo owner created an issue

I checked out the cfviz repo and tried to build it for the first time in, I think, several years.

My installed rustc version at the time of my first attempt was 1.66. I got an error about some package or other requiring rustc 1.70 or newer (I don’t have that particular error output any more to post).

(One issue this highlights already is our use of "*" in the [dependencies] section of Cargo.toml. We should instead pin to known-good versions, and only upgrade to new versions intentionally from time to time.)

Anyways, I ran rustup update stable which installed rustc 1.72, and tried building again, this time getting the following errors:

$ make release
cd frontend/cmd && cargo build --release
   Compiling cfviz-frontend v0.1.0 (/home/botond/dev/projects/rust/cfviz/frontend/cmd)
warning: trait objects without an explicit `dyn` are deprecated
   --> src/main.rs:476:24
    |
476 | fn log_error(mut err: &std::error::Error) {
    |                        ^^^^^^^^^^^^^^^^^
    |
    = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
    = note: `#[warn(bare_trait_objects)]` on by default
help: use `dyn`
    |
476 | fn log_error(mut err: &dyn std::error::Error) {
    |                        +++

error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied
   --> src/main.rs:556:30
    |
556 | fn setup_clap_interface() -> ArgMatches<'static> {
    |                              ^^^^^^^^^^--------- help: remove these generics
    |                              |
    |                              expected 0 lifetime arguments
    |
note: struct defined here, with 0 lifetime parameters
   --> /home/botond/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.4.0/src/parser/matches/arg_matches.rs:67:12
    |
67  | pub struct ArgMatches {
    |            ^^^^^^^^^^

error[E0433]: failed to resolve: use of undeclared type `App`
   --> src/main.rs:558:5
    |
558 |     App::new("cfviz (frontend)")
    |     ^^^ use of undeclared type `App`

Some errors have detailed explanations: E0107, E0433.
For more information about an error, try `rustc --explain E0107`.
warning: `cfviz-frontend` (bin "cfviz-frontend") generated 1 warning
error: could not compile `cfviz-frontend` (bin "cfviz-frontend") due to 2 previous errors; 1 warning emitted
make: *** [Makefile:23: build-release] Error 101

Comments (4)

  1. Botond Ballo reporter

    For the time being I deployed the quick fix of modifying Cargo.toml to pin the clap version used to the major version 2.x, since the errors seem to be related to API changes in newer major versions.

  2. Log in to comment