You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use anyhow::Ok;use argh::FromArgs;#[derive(FromArgs)]/// A simple CLI toolstructArgs{/// the input file#[argh(option)]input:String,}fnmain() -> anyhow::Result<()>{let args:Args = argh::from_env();println!("Hello, world!: input: {}", args.input);Ok(())}
cargo build output:
cargo build
Compiling argh_vs_anyhow v0.1.0(/Users/tao/lab/rust/fortune/project/argh_vs_anyhow)
error[E0308]: mismatched types
--> src/main.rs:4:10
|
4 | #[derive(FromArgs)]
| ^^^^^^^^
| |
| expected `Result<Args,EarlyExit>`, found `Result<Args,Error>`
| expected `Result<Args,EarlyExit>` because of return type
|
= note: expected enum `Result<_,EarlyExit>`
found enum `Result<_, anyhow::Error>`
= note: this error originates in the derive macro `FromArgs` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:4:10
|
4 | #[derive(FromArgs)]
| ^^^^^^^^ expected `Result<String,String>`, found `Result<String,Error>`
|
= note: expected enum `Result<_,String>`
found enum `Result<_, anyhow::Error>`
= note: this error originates in the derive macro `FromArgs` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:4:10
|
4 | #[derive(FromArgs)]
| ^^^^^^^^
| |
| expected `Result<Vec<String>,EarlyExit>`, found `Result<Vec<String>,Error>`
| expected `Result<Vec<String>,EarlyExit>` because of returntype
|
= note: expected enum `Result<_,EarlyExit>`
found enum `Result<_, anyhow::Error>`
= note: this error originates in the derive macro `FromArgs` (in Nightly builds, run with -Z macro-backtrace for more info)For more information about this error, try `rustc --explain E0308`.
error: could not compile `argh_vs_anyhow` (bin "argh_vs_anyhow") due to 3 previous errors
anyhow::Ok conflicted with core::result::Result Ok, so, I believe the fully qualified type path should be used in argh code to avoid the conflict.
The text was updated successfully, but these errors were encountered:
To reproduce the issue, here is the code:
cargo build
output:anyhow::Ok
conflicted withcore::result::Result Ok
, so, I believe the fully qualified type path should be used inargh
code to avoid the conflict.The text was updated successfully, but these errors were encountered: