From cc3656f33feaa69a6ae1560d46e0284a82dbdcac Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 10 Jul 2021 16:19:33 +0100 Subject: [PATCH] zcoord: Reject attempt to make range [X,X> Signed-off-by: Ian Jackson --- base/zcoord.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/zcoord.rs b/base/zcoord.rs index f236ba1d..dbf37491 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -107,6 +107,8 @@ pub struct ParseError; pub enum RangeImpossible { #[error("Z coordinate range has end before start, cannot iterate")] Backwards, + #[error("Z coordinate range has end equal to start, cannot iterate")] + Empty, } #[derive(Error,Clone,Copy,Debug,Eq,PartialEq,Serialize,Deserialize)] @@ -382,7 +384,7 @@ impl Mutable { let aso = 'ok: loop { for i in 0.. { if i >= a.limbs.len() && i >= b.limbs.len() { // Oh actually these numbers are equal! - break 'ok ASRD { i: 0, step: ZERO }; + throw!(RangeImpossible::Empty); } current.extend_to_limb(i); -- 2.30.2