killercup / quicli

Quickly build cool CLI apps in Rust.
https://killercup.github.io/quicli/
Apache License 2.0
540 stars 31 forks source link

bail!() no longer works with quicli 0.4 #106

Open gibfahn opened 5 years ago

gibfahn commented 5 years ago

I think this is caused by https://github.com/rust-lang-nursery/failure/issues/258 and https://github.com/rust-lang-nursery/failure/issues/110, but I thought it worth mentioning, as I hit this upgrading from quicli 0.3 to 0.4.

I'm not sure there's anything that can be done in this crate though, so feel free to close if you want.

Reproduction:

Source

use quicli::prelude::*;

fn main() -> CliResult {
    bail!("This does not work!");
}

Reproduction

cargo new quicli_bail; cd quicli_bail
cargo install cargo-edit
cargo add quicli
echo -e 'use quicli::prelude::*;\n\nfn main() -> CliResult {\n    bail!("This does not work!");\n}' >src/main.rs
cargo build

Result:

   Compiling test_quicli v0.1.0 (/Users/gib/tmp/test_quicli)
error[E0308]: mismatched types
 --> src/main.rs:4:5
  |
4 |     bail!("This doesn't work!");
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `exitfailure::ExitFailure`, found struct `failure::error::Error`
  |
  = note: expected type `exitfailure::ExitFailure`
             found type `failure::error::Error`
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
error: Could not compile `test_quicli`.

To learn more, run the command again with --verbose.
h-michael commented 5 years ago

because of changing returning type.

https://github.com/killercup/quicli/pull/100/files#diff-9b8fab691c00b9e5380b19ce882f3271R16 https://github.com/killercup/quicli/pull/100/files#diff-b4aea3e418ccdb71239b96952d9cddb6R46

That type is from exitfailure