From 41961ce218748ed6efe6c9103c5917c2dfc76de1 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Tue, 12 Jul 2022 17:03:12 +1000 Subject: [PATCH] Add new variant `BinstallError::DuplicateVersionReq` Signed-off-by: Jiahao XU --- src/errors.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/errors.rs b/src/errors.rs index 4c7e5cad..4db5cdd1 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -182,6 +182,12 @@ pub enum BinstallError { help("You specified `--version {req}` but the package resolved that to '{ver}'.\nUse `--version '={req}'` if you want an exact match.") )] VersionWarning { ver: String, req: String }, + + /// This occurs when you specified `--version` while also using + /// form `$crate_name@$ver` tp specify version requirements. + #[error("duplicate version requirements")] + #[diagnostic(severity(error), code(binstall::version::requirement))] + DuplicateVersionReq, } impl BinstallError { @@ -209,6 +215,7 @@ impl BinstallError { VersionMismatch { .. } => 82, VersionUnavailable { .. } => 83, VersionWarning { .. } => unimplemented!("BUG: warnings do not terminate"), + DuplicateVersionReq => 84, }; // reserved codes